ERROR: Cannot write pid file to /var/run/mongodb/mongod.pid: No such file or directory inf fedora 20

后端 未结 5 1344
故里飘歌
故里飘歌 2020-12-31 18:04

MongoDB is not starting. I have installed mongo and mongo was running but after reboot it is not running.

ERROR: Cannot write pid file to /var/run/mon

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 18:44

    What worked for me in Ubuntu is a combination of the answers from @Tuan Nguyen and @Tom Carchrae

    sudo kill $(sudo lsof -t -i:27017) 
    sudo rm -rf /tmp/mongodb-27017.sock
    sudo rm -f /var/lib/mongo/mongod.lock
    sudo rm -f /var/run/mongodb/mongod.pid
    sudo mkdir -p  /var/run/mongodb/
    touch /var/run/mongodb/mongod.pid
    sudo chown -R  mongodb:mongodb /var/run/mongodb/
    sudo chown mongodb:mongodb /var/run/mongodb/mongod.pid
    

    You can then run

    sudo service mongod start
    

提交回复
热议问题