2
我通过vagrant在远程服务器上安装了mongodb。我可以从我的本地系统访问postgres,但mongo不可用。当我通过ssh登录并检查mongo状态时,它说mongo正在运行,我也可以查询。当我尝试使用此命令从我的本地系统连接:Mongo无法连接到远程实例
mongo 192.168.192.168:27017
我得到一个错误
MongoDB shell version: 2.6.5
connecting to: 192.168.192.168:27017/test
2014-12-27T22:19:19.417+0100 warning: Failed to connect to 192.168.192.168:27017, reason: errno:111 Connection refused
2014-12-27T22:19:19.418+0100 Error: couldn't connect to server 192.168.192.168:27017 (192.168.192.168), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
貌似蒙戈不听从其他IP连接?我在mongo设置中评论了bind_ip,但它没有帮助。
通过NMAP命令的服务为192.168.192.168:
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
5432/tcp open postgresql
9000/tcp open cslistener
貌似mongd听
防火墙规则
sudo iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
更新 我蒙戈配置
dbpath=/var/lib/mongodb
#where to log
logpath=/var/log/mongodb/mongodb.log
logappend=true
#bind_ip = 127.0.0.1
#port = 27017
# Enable journaling, http://www.mongodb.org/display/DOCS/Journaling
journal=true
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security. Off is currently the default
#noauth = true
#auth = true
你检查防火墙规则,确认MongoDB是其实监听的接口'0.0.0.0'端口27017? – Brandon
@Brandon更新了我的问题 –
如果它是一个流浪的实例,您可能需要在虚拟机和主机之间设置一个端口...可能是因为您的postgress已经自动完成。检查你的流浪文件。 – Blizz