在robomongo客户端中无法连接到mongodb的问题
我的mongodb是安装在ubuntu虚拟机上的,通过本地的robo去连接的时候总是报错,尝试了很多种方法也是无法成功。
Error: Establish connection failed. Network is unreachable.. Connection: qipai
8:00:17 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:00:17 上午 Info: Connecting to 192.168.31.92:27017...
8:00:24 上午 Error: Establish connection failed. Network is unreachable.. Connection: admin
8:00:41 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:00:41 上午 Info: Creating SSH tunnel to 192.168.31.92:22...
8:00:41 上午 Info: SSH tunnel created successfully
8:00:41 上午 Info: Connecting to 192.168.31.92:27017...
8:00:42 上午 Error: Failed to create SSH channel
8:00:52 上午 Error: Establish connection failed. Network is unreachable.. Connection: admin
8:01:31 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:01:31 上午 Info: Creating SSH tunnel to 192.168.31.92:22...
8:01:31 上午 Info: SSH tunnel created successfully
8:01:31 上午 Info: Connecting to admin [Replica Set]192.168.31.92:27017...
8:01:32 上午 Error: Failed to create SSH channel
8:01:47 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:01:47 上午 Info: Connecting to admin [Replica Set]192.168.31.92:27017...
8:01:57 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:01:57 上午 Info: Replica set name cached as "".
8:02:04 上午 Error: Establish connection failed. No member of the set is reachable.. Connection: admin
8:29:15 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:29:15 上午 Info: Connecting to admin [Replica Set]192.168.31.92:27017...
8:29:25 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:29:25 上午 Info: Replica set name cached as "".
8:29:26 上午 Error: Establish connection failed. No member of the set is reachable.. Connection: admin
8:29:36 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:29:36 上午 Info: Connecting to 192.168.31.92:27017...
8:29:42 上午 Error: Establish connection failed. Network is unreachable.. Connection: admin
8:41:01 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:41:01 上午 Info: Connecting to 192.168.31.92:27017...
8:45:03 上午 Error: Establish connection failed. Network is unreachable.. Connection: admin
8:45:16 上午 Info: Settings saved to: C:/Users/Administrator/.3T/robo-3t/1.1.1/robo3t.json
8:45:16 上午 Info: Connecting to 192.168.31.92:27017...
8:45:24 上午 Error: Establish connection failed. Network is unreachable.. Connection: admin
另外同时发现在浏览器中也是无法打开mongodb
http://192.168.31.92:27017/
开始意识到并不是robo客户端的配置问题,应该是mongodb的配置上有问题的,之前看到一篇文章是mongodb的数据比较大,所以挂载到其他的盘的实现方法中,特别说明需要去掉ip绑定的问题。Network is unreachable,所以修改一下配置试试。
root@ubuntu:/home/benny# vim /etc/mongodb.conf
# mongodb.conf
# Where to store the data.
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
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
"/etc/mongodb.conf" 100L, 2144C written
root@ubuntu:/home/benny#
root@ubuntu:/home/benny#
然后重启mongodb服务器
root@ubuntu:/home/benny# /etc/init.d/mongodb stop
Stopping mongodb (via systemctl): mongodb.service.
root@ubuntu:/home/benny# /etc/init.d/mongodb start
Starting mongodb (via systemctl): mongodb.service.
在浏览器中查看,

问题修复,在robo连接的问题也同样解决了。

网友评论