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

Master-Slave Mode of redis Cluster

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

Share

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

This article will explain in detail about the master-slave model of redis cluster. 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.

Introduction to redis Cluster Master-Slave Mode:

In order to ensure the high availability of data, the concept of master and slave is combined, that is, a master node corresponds to one or more slave nodes (at least one).

Master is responsible for data access (write / query); slave is responsible for synchronizing master data and then backing up.

How redis Cluster Master-Slave Mode works:

After the deployment of the cluster environment, each master node in the cluster will periodically send ping messages to other master nodes. If the master node that receives the ping message does not return the pong message within the specified time, then the master node that sends the ping message will mark it as suspected fail state, and the cluster master nodes will exchange the status information of each master node in the cluster by sending messages to each other.

In a cluster, if more than half of the master nodes mark a master node as suspected fail state, then the marked master node will be officially marked as fail state.

At the same time, a XXX master node fail message is broadcast to the cluster, and all the master nodes that receive the message mark the XXX master node as fail.

The characteristics of Redis master-slave mode:

A Master can have multiple Slaves

In the default configuration, master nodes can read and write, slave nodes can only read operations, and write operations are prohibited

It is meaningless not to modify the configuration so that the slave node supports write operations, because the data written first will not be synchronized to other nodes. Secondly, when the master node modifies the same data, the data of the slave node will be overwritten.

The failure of the slave node does not affect the reading of other slave nodes and the reading and writing of the master node. After restart, the data will be synchronized from the master node.

After the master node is hung up, the reading of the slave node will not be affected, and the Redis will no longer provide write service. After the master node is started, Redis will provide the write service again.

After the master node has passed, a master is not reselected from the slave node.

Description of the case by the password: when the master node sets the password:

* password is required for client to access master

* password is required to start slave. You can configure it in the configuration.

* No password is required for the client to access slave

This is the end of the master-slave mode of redis cluster. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it 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.

Share To

Database

Wechat

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

12
Report