问题描述
我想知道客户端和查询路由器之间的负载平衡和故障转移在MongoDB中如何工作.到目前为止,我还没有找到任何匹配的文档.所有人都说这无关紧要,我也不是这样认为.每一个软件/硬件都会消失,并且总是有一个原因导致您无法立即再次启动它.
I'm wondering how load balacing and failover between client and query routers work in MongoDB. I haven't found any matching documentation so far. Everyone says it's not relevant and I don't think so. Every piece of software / hardware can die and there'll be always a reason why you can't bring it up immediately again.
情况非常简单.假设使用分片复制集进行常规设置,则客户端连接到查询路由器并执行操作.如果查询路由器死亡,会发生什么?是否有用于自动故障转移到第二个查询路由器的预期方法?还是要在2个查询路由器之间进行负载平衡?
The situation is very simple. Assuming a usual setup with sharded replicat sets, a client connects to a query router and performs operations. What happens if the query router dies? Is there an intended way for automatic failover to a second query router? Or for load balancing between 2 query routers?
感谢您的帮助,德克
推荐答案
是您的权利. mongos实例的故障转移非常重要,如果没有适当的体系结构来解决此问题,则您的应用程序可能会出现严重故障.它还破坏了MongoDB的高可用性.
And your right so. Failover of mongos instances is very important, without proper architecture to deal with this you could have a serious failure in your app. It also breaks the high availability of MongoDB.
这是您真正应该在驱动程序中的连接字符串中放入种子列表的地方,在这种情况下,驱动程序将按照与副本相同的方式执行某些操作,并尝试连接到列表中的其他成员恢复正常.
This is where you should really be putting in a seed list into the connection string in your driver, in this case the driver will do something along the lines of what it does with replicas and try and connect to other members on the list to resume as normal.
假设您为应用程序配置提供了更多mongos实例IP,这应该是非常自动化的.
Provided you supply more mongos instance IPs to your applications configuration this should be pretty automated.
如果您只想提供一个IP,也可以采用这种方法,但是您必须担心该负载均衡器,依此类推,以此类推...
You can go that route as well if you want a only supply a single IP, but then you have to worry about that load balancer, and so on, and so forth...
这篇关于查询路由器的MongoDB负载平衡和故障转移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!