mongodb cant start centos 7

14,320

here is the official bug report https://jira.mongodb.org/browse/SERVER-27241

in

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

update the systemd service with the following, till they fix it officially

    [Service]
    User=mongod
    Group=mongod
    Environment="OPTIONS=--quiet -f /etc/mongod.conf"
    PermissionsStartOnly=true
    ExecStartPre=/usr/bin/mkdir /var/run/mongodb
    ExecStartPre=/usr/bin/chown -R mongod:mongod /var/run/mongodb
    ExecStart=/usr/bin/mongod $OPTIONS run
    PIDFile=/var/run/mongodb/mongod.pid
Share:
14,320
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin about 2 years

    I installed mongodb on Centos 7 and all works fine.

    But if I reboot the system, mongodb can't start anymore. If I uninstall and install again, works fine. But after reboot, cant start anymore.

    When I try systemctl status mongod.service shows:

    mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Dom 2016-11-27 09:49:36 BRT; 12min ago Docs: https://docs.mongodb.org/manual Process: 1471 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=1/FAILURE) Main PID: 1471 (code=exited, status=1/FAILURE)

    Nov 27 09:49:19 localhost.localdomain systemd[1]: Started High-performance, schema-free document-oriented database. Nov 27 09:49:19 localhost.localdomain systemd[1]: Starting High-performance, schema-free document-oriented database... Nov 27 09:49:36 localhost.localdomain mongod[1471]: about to fork child process, waiting until server is ready for connections. Nov 27 09:49:36 localhost.localdomain mongod[1471]: forked process: 2828 Nov 27 09:49:36 localhost.localdomain mongod[1471]: ERROR: child process failed, exited with error number 1 Nov 27 09:49:36 localhost.localdomain systemd[1]: mongod.service: main process exited, code=exited, status=1/FAILURE Nov 27 09:49:36 localhost.localdomain systemd[1]: Unit mongod.service entered failed state. Nov 27 09:49:36 localhost.localdomain systemd[1]: mongod.service failed.

    I already tried:

    *chcon -R -t mongod_var_lib_t /var/lib/mongo
    *SElinux=disable
    *chmod 7777 /var/lib/mongo
    and nothing.
    

    I remember when this error appeared before I format my pc, I needed to put permission on systemd with a simple command. But I cant find anymore.