当我尝试启动mongo服务(systemctl,start mongodb)时,我在日志中得到了以下错误:
Mar 21 15:36:18 redhat7 systemd[1]: Started High-performance, schema-free document-oriented database.
Mar 21 15:36:18 redhat7 systemd[1]: Starting High-performance, schema-free document-oriented database...
Mar 21 15:36:18 redhat7 mongod[14333]: about to fork child process, waiting until server is ready for con
Mar 21 15:36:18 redhat7 mongod[14333]: forked process: 14335
Mar 21 15:36:18 redhat7 systemd[1]: mongod.service: main process exited, code=exited, status=1/FAILURE
Mar 21 15:36:18 redhat7 systemd[1]: Unit mongod.service entered failed state.
Mar 21 15:36:18 redhat7 systemd[1]: mongod.service failed.但是将下面的命令作为root运行,就可以了!
sudo -u mongod /usr/bin/mongod -f /etc/mongod1.conf/lib/systemd/system/mongod.service
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongod
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod1.conf
[Install]
WantedBy=multi-user.target发布于 2017-05-27 19:52:53
systemd的默认设置是服务是简单的。这意味着它在前台运行,如果它退出,则认为服务已停止。
您的单神配置文件有以下内容:
processManagement: fork: true
在它中,这将导致mongod分叉到后台。有两种方法可以解决这个问题,最好的方法是将fork中的/etc/mongod1.conf更改为false。另一个是在Type=forking文件的[Service]部分设置.service。
https://serverfault.com/questions/839615
复制相似问题