MongoDB running but can't connect using shell

前端 未结 17 1769
甜味超标
甜味超标 2020-12-23 16:45

CentOS 5.x Linux with MongoDB 2.0.1 (tried main and legacy-static)

MongoDB is running:

root     31664  1.5  1.4  81848 11148 ?        Sl   18:40   0:         


        
17条回答
  •  忘掉有多难
    2020-12-23 17:10

    Open the file /etc/mongod.conf and add the ip of the machine from where you are connecting, to bind_ip

    bind_ip = 127.0.0.1,your Remote Machine Ip Address Here

    Ex:-

    bind_ip = 127.0.0.1,192.168.1.5
    

    Restart mongodb service:

    sudo service mongod restart
    

    Make sure mongodb port is opened in the firewall.

    You can also comment the line, if you are not worried about security.

提交回复
热议问题