美文网首页
Cent OS 7上需要把mongoDB添加到systemd,否

Cent OS 7上需要把mongoDB添加到systemd,否

作者: MrChenyz | 来源:发表于2018-08-14 15:26 被阅读0次

Cent OS 7上需要把mongoDB添加到systemd,否则会出现上面的错误

将mongoDB添加到systemd

vim /usr/lib/systemd/system/mongod.service

[Unit]
Description=mongodb database

[Service]
User=mongod
Group=mongod
Environment="OPTIONS=--quiet -f /etc/mongod.conf"
ExecStart=/usr/bin/mongod $OPTIONS run
PIDFile=/var/run/mongodb/mongod.pid

[Install]
WantedBy=multi-user.target

建立链接
ln -s /usr/lib/systemd/system/mongod.service /etc/systemd/system/multi-user.target.wants/

重新加载systemctl
systemctl daemon-reload

相关文章

网友评论

      本文标题:Cent OS 7上需要把mongoDB添加到systemd,否

      本文链接:https://www.haomeiwen.com/subject/ssdvbftx.html