[JAVA-3287] How to Configure MongoClient to connect to next available Mongos Created: 14/May/19 Updated: 16/Nov/21 Resolved: 20/May/19 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Cluster Management |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | shen Chen | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
We have two Mongos' running, and our web service is registered with two Mongos' in its connection string. Plz correct me if i am wrong, looks like the MongoClient will connect first Mongos in the connection string. Problem: When the first Mongos is down, the MongoClient will not connect to next available Mongos
Expectation: We are not sure if this is possible, we are looking for some help to configure the MongoClient to connect to next available Mongos when the Mongos it's connected fails. |
| Comments |
| Comment by Jeffrey Yemin [ 20/May/19 ] |
|
Hi shen915 It sounds like you have a connectivity problem with one of the mongos servers, and this is unlikely to be a problem specific to the Java driver. Just to let you know this project is for Java driver bugs or feature requests. The best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a broader audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support. If you do follow up via one of the options above please post a link and I will follow the conversation there. |
| Comment by shen Chen [ 18/May/19 ] |
|
Jeff, Thanks for the response. We are currently having an issue with one of our Mongos, when our service attempts to connect to this Mongos, it throws error: connection refused. Our service is constantly processing messages, but it kept on throwing error: connection refused from the same Mongos. The other Mongos is definitely working. We followed the recommendation from the MongoDB Connection String Documentation. Please let us know what info we need to provide for troubleshooting this. |
| Comment by Jeffrey Yemin [ 16/May/19 ] |
|
MongoClient is design to connect to all mongos in the connection string, and balance the load across them. Can you share any evidence you have to the contrary? |