0
votes

I have multiple mongos in below URI. mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

mongodb://username:password@host123:40000,host124:40000,host124:40000/admin?ssl=true

We are created a MongoClient and try to read some value from collection, then prints

System.out.println("Server Address: " + mongoClient.getAddress());
System.out.println("Connection Point: " + mongoClient.getConnectPoint());

It always returning host123, its not working as round robin. Any changes required in connection URI?

1

1 Answers

0
votes

MongoDB will use hostN as a fall over for redundancy, if you want to deploy load balancing you'll have to deploy your own load balancer to the mix.