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
--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:
You should map the external IP port to the internal IP port, right?
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.