In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "what is the method of manually selecting the master node of the replication group in the database". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
[detailed description of the problem]
How to manually select the master node of a replication group?
[solution]
1. In the replication group, each node can set the voting weight. When the LSN is the same, the node with the largest weight becomes the primary node. Therefore, you can configure weight through the database, and then call the SdbReplicaGroup.reelect () interface to achieve the manual selection of the primary node.
2. The SdbReplicaGroup.reelect () interface will block the write operation and wait for the node LSN to be consistent before the election. If it times out, it will fail and report an error.
3. For example, group1 on v3.0 has nodes sdbserver:11720 (master) and sdbserver:11750 (standby). The main reference steps are as follows:
> var db = new Sdb ()
> db.updateConf ({weight: 20}, {GroupName: "group1", Svcname: "11750"})
> db.snapshot (SDB_SNAP_CONFIGS, {NodeName: "sdbserver1:11720"}, {weight: 1})
{
"weight": 10
}
> db.snapshot (SDB_SNAP_CONFIGS, {NodeName: "sdbserver1:11750"}, {weight: 1})
{
"weight": 20
}
> db.getRG ('group1'). Reelect ()
When you are finished, look at the master node and switch.
This is the end of the content of "what is the method of manually selecting the master node of the replication group in the database". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.