Open jingxinxin opened 7 years ago
Thank you! I have been searching for 2 hours, and your solution works!
@jiakangyuchi you're welcome! This project is mainly used to record the problems encountered in the development process, and very happy can help you.
@jingxinxin Thank you so much.
This solution works for me but if you don't mind, I want to know the root cause behind this error and why it is fixed with the solution you provided.
Can you elaborate this?
Thank you.
Never thought I'd find the answer to my problem here, Thanks a lot !
Gracias, Funciona perfectamente
这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
Thank you
Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2017-10-20 19:07:23 CST; 8s ago Docs: man:systemd-sysv-generator(8) Process: 10814 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
Oct 20 19:07:23 iZ114ypdot6Z systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database.... Oct 20 19:07:23 iZ114ypdot6Z mongod[10814]: Error starting mongod. /var/run/mongodb/mongod.pid exists. Oct 20 19:07:23 iZ114ypdot6Z systemd[1]: mongod.service: control process exited, code=exited status=1 Oct 20 19:07:23 iZ114ypdot6Z systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database.. Oct 20 19:07:23 iZ114ypdot6Z systemd[1]: Unit mongod.service entered failed state. Oct 20 19:07:23 iZ114ypdot6Z systemd[1]: mongod.service failed.
Cent OS 7上需要把mongoDB添加到systemd,否则会出现上面的错误
将mongoDB添加到systemd
# vim /usr/lib/systemd/system/mongod.service
建立链接
ln -s /usr/lib/systemd/system/mongod.service /etc/systemd/system/multi-user.target.wants/
重新加载systemctl
systemctl daemon-reload