mongodb 外网IP启动失败
ringa_lee
ringa_lee 2017-04-26 09:02:01
0
4
808

centos 部署mongodb 服务器。 启动命令

/usr/local/mongodb/bin/mongod --bind_ip 内网ip 或127.0.0.1 --port 27017 --maxConns 20000 --dbpath=/usr/local/mongodb/db --logpath=/usr/local/mongodb/log/mongo.log --logappend &
;;

可以启动成功。

/usr/local/mongodb/bin/mongod --bind_ip 外网ip --port 27017 --maxConns 20000 --dbpath=/usr/local/mongodb/db --logpath=/usr/local/mongodb/log/mongo.log --logappend &
;;

启动失败
[ 防火墙已关闭,27017端口也开启]
错误日志:
[initandlisten] listen(): bind() failed errno:99 Cannot assign requested address for socket: 外网ip:27017
[initandlisten] journal dir=/usr/local/mongodb/db/journal
Durability thread stopped

ringa_lee
ringa_lee

ringa_lee

reply all (4)
仅有的幸福

--bind_ip # Bind the service IP. If bound to 127.0.0.1, it can only be accessed locally. If not specified, all IPs can be accessed by default. If you want to allow the external network to access your database, just don't specify this parameter!

    某草草

    Judging from the error message, there are a few things to check:

    1. Is there any program occupying port 27017 of the external IP address: sudo netstat -pln | grep 27017
    2. Have you made a mistake in the external IP address: ifconfig | grep inet
      仅有的幸福

      You should map the external IP port to the internal IP port, right?

        phpcn_u1582

        It should not be that the port is occupied. If it is, the error should be Already in use. I suspect that there are multiple network cards on your host, and the port of one of the network cards is still restricted by the firewall. I would like to verify it.

          Latest Downloads
          More>
          Web Effects
          Website Source Code
          Website Materials
          Front End Template
          About us Disclaimer Sitemap
          php.cn:Public welfare online PHP training,Help PHP learners grow quickly!