Spring boot with mongoDB connection tried to connect with Arbiter node throwing connection timeout

48 Views Asked by At

I have Spring boot with spring data mongo connection with below connection URL

spring.data.mongodb.uri= mongodb://mongoUs:mongoPs@primary@mongo,secondary@mongo:27027/mgbd?authSource=mgdb&replicaSet=rc&ssl=true

As observed sometime application tried to connect with arbiter node (arbiter@mongo), this arbiter node is not part of url but part of replica set. And due to this application startup will be failed.

Error: Caused by: java.net.SocketTimeoutException: Connect timed out

Need help how I can avoid the application to connect with Arbiter node.

0

There are 0 best solutions below