mongod启动问题

使用mongod --config /etc/mongod.conf & 启动mongodb,然后过段时候后发现自己退出了,检查log:

2018-12-29T06:53:15.079+0000 I CONTROL  [signalProcessingThread] got signal 1 (Hangup), will terminate after current cmd ends
2018-12-29T06:53:15.079+0000 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2018-12-29T06:53:15.080+0000 I STORAGE  [conn3] got request after shutdown()
2018-12-29T06:53:15.082+0000 I CONTROL  [signalProcessingThread] now exiting
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] closing listening socket: 6
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] closing listening socket: 7
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2018-12-29T06:53:15.082+0000 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...

是收到关闭信号,正常关闭的。
google之后发现是因为没有-fork,所以当shell退出的时候,mongodb也退出了。
所以,需要加上--fork。启动server模式

mongod --config /etc/mongod.conf --fork

搞定。

你可能感兴趣的:(mongod)