远程连接mongodb失败Exception opening socket解决办法

以下是报错内容:
Connection failed

SERVER [192.168.168.147:27017] (Type: UNKNOWN)
|/ Connection error (MongoSocketOpenException): Exception opening socket
|
___/ Socket error: Connection refused: connect

Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.168.147:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]

解决办法:

将配置的mongodb.conf中bindIP:127.0.0.1 改为0.0.0.0将这一行注释掉
127.0.0.1只允许本地连接,不接受远程连接mongodb

你可能感兴趣的:(远程连接mongodb失败Exception opening socket解决办法)