Cent OS 7上須要把mongoDB添加到systemd,不然會出現上面的錯誤mongodb
將mongoDB添加到systemdvim
# vim /usr/lib/systemd/system/mongod.service
ui
[Unit]
Description=mongodb databasecode[Service]
User=mongod
Group=mongod
Environment="OPTIONS=--quiet -f /etc/mongod.conf"
ExecStart=/usr/bin/mongod $OPTIONS run
PIDFile=/var/run/mongodb/mongod.pidip[Install]
WantedBy=multi-user.targetget
創建連接ln -s /usr/lib/systemd/system/mongod.service /etc/systemd/system/multi-user.target.wants/
it
從新加載systemctlsystemctl daemon-reload
io