Unable to connect to MongoDB

前端 未结 9 1114
借酒劲吻你
借酒劲吻你 2021-02-02 11:17

I\'ve just installed MongoDB (standard Ubuntu build, not the latest stable) and for some reason I can\'t connect:

Mon Feb  6 03:11:22 Error: couldn\'t connect to         


        
相关标签:
9条回答
  • 2021-02-02 12:08
    sudo rm /var/lib/mongodb/mongod.lock
    
    0 讨论(0)
  • 2021-02-02 12:10

    I solved this problem by commenting out the following line in my /etc/mongod.conf file.

    # Listen to local interface only. Comment out to listen on all interfaces. 
    #bind_ip = 127.0.0.1
    

    You will need to follow this config change with restarting the mongod process.

    sudo service mongod restart
    
    0 讨论(0)
  • 2021-02-02 12:13

    in /etc/mongod.conf

    I changed,

    bindIp: 127.0.0.1

    to

    bindIp: 0.0.0.0

    which is all ports. Yeah, I know it's risky, but I am running on an internal network.

    BTW commenting out #bindIp: 127.0.0.1 did NOT work for me, running under Ubuntu 18.

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