Exception in thread "main" 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=[{address=hadoop02:12345, type=UNKNOWN, state=
CONNECTING, exception={com.mongodb.MongoSocketOpenException:
Exception opening socket}, caused by {java.net.SocketTimeoutException:
connect timed out}}]
Java cannot connect to Mongodb
Solution:
Modify mongod.conf in the conf file
Add bind_ip=0.0.0.0 to allow all access
Then you can connect Navicat to test whether it can be connected