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

How is the new master node of redis generated?

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

Share

Shulou(Shulou.com)06/01 Report--

How is the new master node of redis generated? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

The new master node is elected and the lead election "leader election" method based on Raft algorithm is realized; each master node in the cluster responsible for processing slot has a chance to vote, and the first slave node that asks for a vote from the master node will get the vote from the master node.

Elect a new master node

Redis-Cluster is a clustering scheme officially launched by Redis, and its distributed consistency protocol is based on Gossip algorithm. When the master node fails in Redis-Cluster, the cluster will go through three steps: fault detection, election and fault switch. the new master node is elected and realized by lead election (leader election) based on Raft algorithm.

Each master node in charge of the processing slot in the cluster has a chance to vote, and the slave node that first asks the master node to vote will get the vote from the master node.

When the slave node finds that the master node it is replicating has entered the offline state, the slave node will broadcast a message to the cluster, requiring all master nodes that receive the message to vote for the slave node.

If the master node with the right to vote has not voted for another node, the master node will respond to the message indicating that the master node supports the slave node to become the new master node

Each slave node participating in the election receives a message and counts how many master nodes he or she has received.

If the cluster has N master nodes with voting rights, then when a slave node collects 2 + 1 support votes greater than or equal to Nmax, the slave node will be selected as the new master node.

If not enough support votes are collected from the slave node, the cluster will elect again until a new master node is selected.

The answer to the question about how the new master node of redis is generated is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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