Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

前端 未结 27 2600
孤街浪徒
孤街浪徒 2020-12-12 15:06

while trying this mongo command in ubuntu I am getting this error.

    ritzysystem@ritzysystem-Satellite-L55-A:~$ mongo
    MongoDB shell version: 2.6.1
             


        
27条回答
  •  醉酒成梦
    2020-12-12 15:11

    I faced the same problem, so please check is there mongodb folder, firstly try to remove that folder

    rm -rf /var/lib/mongodb/*
    

    Now try to start mongo and if same problem then its mongodb lock file which prevent to start mongo, so please delete the mongo lock file

    rm /var/lib/mongodb/mongod.lock
    

    For forcefully rm -rf /var/lib/mongodb/mongod.lock

    service mongodb restart if already in sudo mode otherwise you need to use like sudo service mongod start

    or you can start the server using fork method

    mongod --fork --config /etc/mongod.conf
    

    and for watching the same is it forked please check using the below command

    ps aux | grep mongo
    

提交回复
热议问题