mongodb - Ubuntu下 mongod 在shell 界面 按 ctrl +c 就退出服务了
phpcn_u1582
phpcn_u1582 2017-05-02 09:17:46
0
5
937

Linux命令窗口直接Ctrl+C退出,那么mongod就会被关闭

$ mongod
2016-02-01T17:51:24.743+0800 I CONTROL  [initandlisten] MongoDB 
starting : pid=19587 port=27017 dbpath=/data/db 64-bit host=iZ28krk4xlkZ

在使用 mongod 的配置中运行 --fork 不行

mongod --fork
BadValue --fork has to be used with --logpath or --syslog
try 'mongod --help' for more information

根据提示 修改如下 还是error

mongod --fork --logpath '/data/log'
about to fork child process, waiting until server is ready for connections.
forked process: 28117
ERROR: child process failed, exited with error number 1

使用官方 的 安装 文档
如何 持久化运行 mongodb 服务

phpcn_u1582
phpcn_u1582

reply all(5)
仅有的幸福

nohup mongod &

世界只因有你

Set fork to true, it is best to create a configuration file, and then mongod -f mongo.conf, mongo.conf is the configuration file

port = 12345
dbpath = data
dblog = log/mongod.log #logpath
fork = true

It seems that the log path was renamed logpath in 3.0

我想大声告诉你

Can use supervisor and nohup commands

过去多啦不再A梦

If you follow the tutorial on the official website, you should see sudo service mongod startthis command, so that mongodb will run as a service in the background.

習慣沉默

The above methods all bypass the cause of the error.
Under normal circumstances: mongod --fork --logpath '/data/log' can be started successfully in the background (available for personal testing)

It is recommended to check:

  1. Is there a file /data/log

  2. If yes, check the access permissions of the file to see if the current user has write permissions.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template