不带仲裁器的两个节点MongoDB副本集 [英] Two nodes MongoDB replica set without arbiter

查看:190
本文介绍了不带仲裁器的两个节点MongoDB副本集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以创建仅包含1个主要成员和1个辅助成员的MongoDB副本集? 我想要延迟副本集,该副本集将延迟24小时从主数据库复制数据.我知道我可以将仲裁器放在其中一台服务器上(主服务器或辅助服务器,我知道不建议这样做,但我唯一的愿望是在两台服务器上运行此配置),它可以正常运行,但是我想知道是否有可能彻底将仲裁员踢出去. 它看起来像这样:

Is it possible to create a MongoDB replica set consisting of only 1 primary and 1 secondary member? I would like to have delayed replica set that will copy data from primary with delay of 24 hours. I know I can put arbiter on one of the servers (primary or secondary, I know this is not advised but my only wish is to run this configuration on two servers) and it would run fine, but I want to know if it is possible to completely kick arbiter out. It would look like this:

推荐答案

简短的回答:不用.

长答案:自动故障转移在MongoDB中的工作方式是,副本集需要合格多数才能成功选出新的主数据库.拖延的议员在选举中确实有选票.因此,如果您的任一节点 失败,则副本集将发现副本集没有多数,并且即使副本节点没有失败,当前主节点也会下台.因此,您实际上要做的是加倍使副本集失败的机会.就RAM使用率,CPU甚至磁盘空间(使用--smallfiles --no-journal --noprealloc或配置文件中设置的等效选项运行)而言,仲裁程序是一个非常便宜的过程.请注意,提到的选项是可以安全使用的,因为仲裁器实际上仅检查数据承载节点的心跳.例如,您可以将仲裁程序放在应用程序服务器上.

Long answer: the way automatic failover works in MongoDB is that a replica set needs a qualified majority to successfully elect a new primary. Delayed members do have votes in elections. So if either of your nodes fails the replica set finds out that it doesn't have this majority and the current primary steps down even if it didn't fail. So what you essentially do is doubling the chances of making your replica set fail. An arbiter is a very cheap process, in term of RAM usage, CPU and even disk space when run with --smallfiles --no-journal --noprealloc or the equivalent options set in the config file. Note that the mentioned options are safe to use, since an arbiter essentially only checks the heartbeats of the data bearing nodes. You could put the arbiter on the application server for example.

免责声明:强烈建议不要使用以下过程.后果自负.

您可以将延迟服务器的票数设置为0.这样,在延迟成员失败的情况下,未延迟节点将要求进行选举,得出的结论是,它是副本集的唯一联机节点. ,它拥有多数票(1/1),并将继续按预期工作.此操作过程需要引起注意,因为如果以后将成员添加到副本集并有必要重新配置副本集,您将再次获得偶数票.它也对网络碎片化问题产生了严重的影响.再说一次:使用后果自负

You could set the votes of the delayed server to 0. This way the undelayed node will call for an election in case the delayed member fails, comes to the conclusion that it is the only node online of the replica set and that it has the majority of votes (1/1) and will continue to work as expected. This course of action needs some attention, as you will have an even number of votes again in case you add a member to the replica set later and makes it necessary to reconfigure the replica set. It also has serious implications with network fragmentation issues. Again: Use at your own risk

这篇关于不带仲裁器的两个节点MongoDB副本集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆