mongo连接不上Timed out after 30000

 

 

 

 

本地连接mongo报错,错误代码为:

Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. 
Client view of cluster state is {type=UNKNOWN, servers= ...............................

 

系统: 

  centos7, 64位

  mongo,mongodb-linux-x86_64-rhel70-4.0.10

解压,进入bin,启动

 ./mongod --dbpath=/data/db/ --config=./mongodb.conf &

 

报错了

mongo连接不上Timed out after 30000_第1张图片

 

为什么呢?

用linux本地连接mongo测试 --》 是ok的,证明服务没有问题

mongo连接不上Timed out after 30000_第2张图片

 

那是什么呢?--》防火墙

 

[root@localhost data]# systemctl stop firewalld.service #停止firewall
[root@localhost data]# systemctl disable firewalld.service #禁止firewall开机启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost data]# 

搞定ok!!!!

 

转载于:https://www.cnblogs.com/renfanzi/p/10998844.html

你可能感兴趣的:(mongo连接不上Timed out after 30000)