Java接続mongodbエラータイムアウトと接続失敗

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はMongodbに接続できません

解決:

confファイルのmongod.confを変更します

bind_ip = 0.0.0.0を追加して、すべてのアクセスを 許可します

次に、Navicatを接続して、接続できるかどうかをテストできます

おすすめ

転載: blog.csdn.net/Poolweet_/article/details/108584967