Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the architectures of Replica Sets mechanism in 4sq

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

The content of this article mainly focuses on the architecture of the Replica Sets mechanism in 4sq. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!

In addition to the most common Master/Slave mode, MongoDB's replication mechanism is even more powerful because it supports automatic failover ReplicaSets mode. Compared with its problematic auto-sharding mechanism, ReplicaSets is still relatively stable.

There are several architectures of ReplicaSets mechanism in 4sq.

1. Add an arbiter to the original Master/Slave mechanism

4sq has some Master/Slave MongoDB architecture in the early days, but this mode does not achieve automatic failover and requires manual switching in the event of a failure. After the advent of ReplicaSets, this structure was migrated to the ReplicaSets of three machines: one Primary, one Secondary, and one Arbiter.

Migration process:

Modify the configuration of Master and slave, add the following items, and restart MongoDB.

ReplSet=auxdb

Fastsync=true

Rest=true

Fastsync allows the restart to use the original data file, and the restart will be very fast. Then add Secondary and Arbiter on Primary with rs.add and rs.addArb. Even if it's done.

There are several architectures of ReplicaSets mechanism in 4sq.

two。 One Primary for writing, multiple Secondary for reading, and one Secondary for backup

In the application of writing more and reading less, 4sq mainly uses ReplicaSets to achieve the separation of reading and writing. By specifying slaveOk at the time of connection, the read operation is put on the Secondary, and the Primary only takes on the write operation. At the same time, specify a Secondary with priority 0 and true hidden for backup (after this setting, this machine is not visible in both reading and writing, and will not be elected as Primary)

3.MongoDB classic configuration, the upper layer is Auto-Sharding, and each Sharding node is a ReplicaSets

Although 4sq has suffered from this, it is clear that they have learned their lessons and are using the tempting feature of Auto-Sharding more reasonably and carefully.

Thank you for your reading. I believe you have some understanding of "what is the architecture of the Replica Sets mechanism in 4sq?" go ahead and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report