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

前端 未结 27 2524
孤街浪徒
孤街浪徒 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:30

    thank you everyone I tried running mongo it was not running finally I found there was no space in my hard disc I emptied some of the space and finally re installed it the same installation procedure as followed to install as given in mongodb docs finally restarted the server and it is running.

    https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu

    0 讨论(0)
  • 2020-12-12 15:30

    I understand the question is with regards to Ubuntu.

    But if you're getting the same error on a Mac and don't want $ sudo mongod running on a separate tab, you can do the following to fix the connection error, if you have Homebrew -

    brew services start mongodb
    

    Based on the answer from this thread - Cannot connect to mongodb errno:61 Connection refused

    0 讨论(0)
  • 2020-12-12 15:31

    In my case the problem was caused due to an apparent lost of permission over mongodb.lock file. I could solve the problem changing the permission with the following command :

    sudo chown mongodb:mongodb /var/lib/mongodb/mongodb.lock
    

    There follows my investigation:

    0 讨论(0)
  • 2020-12-12 15:31

    Follow this simple steps; (Works on MAC OS too)

    1. Open terminal and run sudo mongod

    2. Open a new terminal tab(Don't close step 1 tab) and run sudo mongo

    That's all

    0 讨论(0)
  • 2020-12-12 15:34

    In my case the error was due to missing /data/db folder which the mongodb uses to store your data. Please type this command $sudo mongod in your terminal. If the error message is something like :

    missing data/db folder error

    Simply create the folder and you are good to go.

    0 讨论(0)
  • 2020-12-12 15:34

    Probably you don't have space in your hard drive. Check it by typing in the promt df -h

    Please note that mongo might fail even with 3gb available in the corresponding partition. For details, you might want to check the log: cat /var/log/mongodb/mongod.log

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