Unable to connect to MongoDB

前端 未结 9 1089
借酒劲吻你
借酒劲吻你 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 11:53

    I had the same issue just because the silly mistake.

    first remove mongodb file which is fine

    rm -rf /tmp/mongodb-27017.sock
    

    where I did mistake inside the /etc/mongod.conf

    # network interfaces
    net:
      port: 27017
     #bindIp: 127.0.0.1
    bindIp: privateIp
    

    instead of

    net:
      port: 27017
      bindIp: 10.1.2.4
    

    for listen to all available ips

    bindIp: [127.0.0.1,10.128.0.2]
    

    restart the mongodb

    sudo service mongod start
    

    hopefully this answer help for someone

提交回复
热议问题