In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-05-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to build a delay node slave library in MongoDB. The content is very detailed. Interested friends can refer to it for reference. I hope it can help you.
MongoDB build delay node slave library
[Concept]
The delay node also replicates data from the master node, however the data set in the delay node will be later than the data set in the master node in the replication set. For example, if it is 09:52 and the delay node is 1 hour late, then there will be no operations after 08:52 in the delay node's dataset.
Mongo does not have archive files like oracle's archive and mysql's binlog like some relational databases. His files are oplog, which are written over loops. If you want to find the previous data, it is more troublesome to recover it. Therefore, consider this point and use delayed node slave library. Because the data set of a delayed node is delayed, it can help us recover data in case of human error or other unexpected situations. For example, when an application upgrade fails, or a table or database is deleted by mistake, we can recover data through delay nodes.
[Notes]
1 Priority must be 0 to prevent delayed nodes from becoming master
2 must be hidden members, this is to prevent users from reading from the library to find the delay node
3 also participate in the voting of the main library, in rs.conf() members[0].votes is also 1
4 Delay Node replicates the oplog at the source of the application after a delay time. If the delay setting is large, it must be equal to or greater than the expected maintenance window time. Must be less than storage capacity of oplog
5 In fragmentation clusters, delay nodes have limited effect when balancer is turned on. Because segment migration occurs during the latency period, the latency nodes in the replication set cannot provide effective assistance in restoring the fragmentation cluster.
[Method]
The following is a replica set with 3 members: one master and two slaves. When a member is set to delay after 3600 seconds, the delayed member must be hidden and have priority 0.
[Configuration]
1 members[n].priority=0
2 members[n].hidden=true
3 members[n].slaveDelay=3600
{
"_id" : ,
"host" : ,
"priority" : 0,
"slaveDelay" : ,
"hidden" : true
}
Specific examples:
cfg=rs.conf() /* Find the array number that needs to be changed to delayed synchronization */;
cfg.members[1].priority=0
cfg.members[1].slaveDelay=120
cfg.members[1].hidden=false
rs.reconfig(cfg)
About how to build delay nodes in MongoDB from the library to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.
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.