简体   繁体   English

如何连接到Mongo分片集群

[英]How to connect to mongo sharding cluster

In a regular replica set, we can implement Java code connect to the replica set in case on server is down, the client still works without modifying code. 在常规副本集中,我们可以实现将Java代码连接到副本集的情况,以防服务器停机,客户端仍然可以正常工作而无需修改代码。 In a sharding cluster, the cluster can only connect to one routing server, if I have three routing servers in the sharding cluster, how can I have the same client as in the replica set case? 在分片群集中,该群集只能连接到一个路由服务器,如果我在分片群集中有三台路由服务器,那么我如何拥有与副本集情况下相同的客户端? I don't want to modify the client too much. 我不想过多地修改客户端。

Thanks a lot. 非常感谢。

Got the answer from mongo doc, it is the same as replica set. 从mongo doc得到了答案,它与副本集相同。 http://api.mongodb.org/java/2.10.0/com/mongodb/MongoClient.html http://api.mongodb.org/java/2.10.0/com/mongodb/MongoClient.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM