Mongo: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145

前端 未结 6 1526
轻奢々
轻奢々 2021-01-31 05:41

When I try to run mongo in shell in ubuntu or open rockmongo I see this error:

couldn\'t connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145


        
相关标签:
6条回答
  • 2021-01-31 06:01

    even i had the same problem so i deleted the mongod lock file

    sudo rm /var/lib/mongodb/mongod.lock
    

    and the restart the server it worked , restarting by command below

    sudo service mongodb restart
    
    0 讨论(0)
  • 2021-01-31 06:05

    I assume that you followed the steps, outlined here.

    Most probably you have a problem with mongo lock (or at least I had it once while installing on ubuntu). I solved it with the following commands:

    sudo rm /var/lib/mongodb/mongod.lock
    sudo service mongodb restart
    

    P.S. I by myself recently experienced this problem when I was updating my amazon ec2 instance. I have not properly shut down mongo before doing this and this resulted in a problem with mongo lock.

    0 讨论(0)
  • 2021-01-31 06:06

    i got the solution by changing the owner of db directory to 'mongodb'

    `sudo chown -R mongodb:mongodb /data/*`
    

    then type 'mongo'

    0 讨论(0)
  • 2021-01-31 06:08

    Check your log file of mongodb. you will get to know the exact issue.

    tail -f /var/log/mongodb/mongodb.log
    

    The issue may because of "ERROR: Insufficient free space for journal files"

    Increase your volume space that will fix your issue.

    0 讨论(0)
  • 2021-01-31 06:08

    I guess the reason why you cannot connect to mongodb is the insufficient space in the drive on your computer.

    0 讨论(0)
  • 2021-01-31 06:16

    If you got this after a restart... Make sure that you have over 3GB+ of space free else Mongo Won't start.

    0 讨论(0)
提交回复
热议问题