当没有打开连接时,mongod运行nohup退出

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了当没有打开连接时,mongod运行nohup退出相关的知识,希望对你有一定的参考价值。

我在mongod上运行nohup

nohup mongod -dbpath /data/db > log/nohup.log &

服务器运行一段时间,但关闭后跟日志

2015-08-24T20:23:12.076+0000 I NETWORK  [conn74] end connection 127.0.0.1:51016 (0 connections now open)
2015-08-24T20:23:57.112+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51019 #75 (1 connection now open)
2015-08-24T20:23:57.118+0000 I NETWORK  [conn75] end connection 127.0.0.1:51019 (0 connections now open)
2015-08-24T20:24:56.026+0000 I CONTROL  [signalProcessingThread] got signal 1 (Hangup), will terminate after current cmd ends
2015-08-24T20:24:56.026+0000 I CONTROL  [signalProcessingThread] now exiting
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] closing listening socket: 5
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] closing listening socket: 6
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2015-08-24T20:24:56.026+0000 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...
2015-08-24T20:24:56.026+0000 I STORAGE  [signalProcessingThread] shutdown: waiting for fs preallocator...
2015-08-24T20:24:56.026+0000 I STORAGE  [signalProcessingThread] shutdown: final commit...
2015-08-24T20:24:56.026+0000 I JOURNAL  [signalProcessingThread] journalCleanup...
2015-08-24T20:24:56.027+0000 I JOURNAL  [signalProcessingThread] removeJournalFiles
2015-08-24T20:24:56.045+0000 I JOURNAL  [signalProcessingThread] Terminating durability thread ...
2015-08-24T20:24:56.129+0000 I JOURNAL  [journal writer] Journal writer thread stopped
2015-08-24T20:24:56.129+0000 I JOURNAL  [durability] Durability thread stopped
2015-08-24T20:24:56.129+0000 I STORAGE  [signalProcessingThread] shutdown: closing all files...
2015-08-24T20:24:56.132+0000 I STORAGE  [signalProcessingThread] closeAllFiles() finished
2015-08-24T20:24:56.132+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2015-08-24T20:24:56.132+0000 I CONTROL  [signalProcessingThread] dbexit:  rc: 0

关于如何使mongod持续运行的任何想法?

答案

答案很简单,就是使用--fork将mongod作为恶魔开始

mongod --fork --logpath log/mongod.log

mongodb documents

以上是关于当没有打开连接时,mongod运行nohup退出的主要内容,如果未能解决你的问题,请参考以下文章

nohup 后台不挂断运行程序

nohup执行后退出终端为何进程消失?急

linux中nohup 与 & 的区别

解析nohup java -jar xxx &

后台运行命令

ubuntu nohup命令用法