我的Kubernetes集群中有两个Pod-一个可以很好地连接到我的MongoDB Atlas集群,另一个由于以下异常而失败:
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=REPLICA_SET, servers=[{address=MY_MONGO_SERVER1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=MY_MONGO_SERVER2:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=MY_MONGO_SERVER3:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
现在,我不确定为什么一个吊舱能够连接,而第二个吊舱却无法连接。我们还有另一个环境(生产环境),该环境具有类似的配置,并且在该环境的Pod上一切正常。而且,该环境可以在相同Atlas集群大小的数据库上运行,并具有类似配置的Kubernetes部署。