i1zhuxian 发表于 2015-11-25 13:20:43

mongodb 无法链接

本帖最后由 i1zhuxian 于 2015-12-3 16:59 编辑

# ./mongo 192.168.0.123/test
MongoDB shell version: 3.0.7
connecting to: 192.168.0.123/test
2015-11-25T10:47:43.105+0800 W NETWORKFailed to connect to 192.168.0.123:27017 after 5000 milliseconds, giving up.
2015-11-25T10:47:43.109+0800 E QUERY    Error: couldn't connect to server 192.168.0.123:27017 (192.168.0.123), connection attempt failed
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

服务端启动OK也有监听27017端口
tcp      0      0 0.0.0.0:27017               0.0.0.0:*                   LISTEN      5439/./mongod      
本地是可以链接的 但在其他机器上就无法链接到这个mongodb
# ./mongo localhost/test
MongoDB shell version: 3.0.7
connecting to: localhost/test
Server has startup warnings:
2015-11-25T10:47:08.953+0800 I CONTROL ** WARNING: You are running this process as the root user, which is not recommended.
2015-11-25T10:47:08.953+0800 I CONTROL
>
bye

配置文件如下:
dbpath=/data/mongodb/db
logpath=/data/mongodb/logs/mongodb.log
port=27017
fork=true
nohttpinterface=true
noauth=true
bind_ip=0.0.0.0

客户端也确认是OK的 (连接到其他的mongodb正常) ,这台的配置和其他的都一样,也怀疑过时配置或安装包问题,但重装,或直接将那一个OK的tar过来,还是有这个问题,iptables和selinux都是关闭的。不知道是哪个环节出问题了。跪求支招啊{:6_456:}

098098 发表于 2015-11-26 11:42:11

bind_ip=0.0.0.0 改成192.168.0.123 然后mongo -h 192.168.0.123 试试

i1zhuxian 发表于 2015-12-3 17:01:11

555.....最终发现是网络问题,这台机器的路由端口映射没弄好
页: [1]
查看完整版本: mongodb 无法链接