In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to add an arbitration node to MongoDB to report an error replica set IDs do not match. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Background:
Due to historical reasons, a MongoDB replica set has only one master and one slave, which can not meet the requirements of automatic failover, so it is necessary to configure an arbitration node.
The original node 192.168.10.20 VR 27017192.168.10.21 VR 27017 is now ready to configure a new node 27018 on 20 as an arbitration
Execute on the current primary node
Repset:PRIMARY > cfg= {_ id: "repset", members: [{_ id:0, host:'192.168.10.20:27017', priority:1}, {_ id:2, host:'192.168.10.21:27017', priority:2}, {_ id:3, host:'192.168.10.20:27018', arbiterOnly:true}]}; repset:PRIMARY > rs.reconfig (cfg)
Show that the configuration is successful, and then when you use the command to check the status of the replica set, you find that the arbitration node is not available and the error message replica set IDs do not match.
Repset:PRIMARY > rs.status ()
All kinds of documents on the Internet say that ① checks whether the name of the replica set is the same. ② deletes all the data on the node.
After confirming that the replica set configuration name is consistent, when deleting the data of the arbitration node, I found that: 1, the replica set configuration set cannot be deleted through the client; 2, deleting the underlying physical files will cause the Mongod process to fail to start.
When you carefully recall the operation of the initiate one-time replica set configuration, after discovering the configuration, only one client is started. My guess is that because I started the client of the quorum node, the quorum node generated a separate replica set ID.
So I deleted all the configuration files db, log, Mongodb.conf of the arbitration node, and re-ordered that after starting the MongoD process of the arbitration node, I found that the arbitration node was normal directly after the current Primary node added the arbitration node according to the previous operation.
Conclusion:
So far, only my conjecture has been confirmed, and no official statement has been found yet.
When adding a replica set node, the new node must not connect to the client after starting the service, otherwise the new node will generate another replica set ID. Although the replica set name is the same, an error will be reported if the IDs is inconsistent.
This is the end of the article on "how to add an arbitration node to MongoDB to report an error replica set IDs do not match". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.