Home  >  Article  >  Database  >  Is redis master-slave mode a cluster?

Is redis master-slave mode a cluster?

(*-*)浩
(*-*)浩Original
2019-11-23 10:44:041686browse

Is redis master-slave mode a cluster?

# counter Caps Cross Model Introduction:

(Recommended Learning: Redis Video Tutorial )

In order to ensure the high availability of data, the concept of master-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 it up.

The redis cluster master-slave mode works:

After the cluster environment is deployed, each master node in the cluster will regularly send messages to other master nodes. Ping message, if the master node receiving the ping message does not return the pong message within the specified time, the master node sending the ping message will mark it as a suspected fail state, and the cluster master nodes will send messages to each other. To exchange status information of each master node in the cluster.

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

At the same time, a XXX master node fail message will be broadcast to the cluster. All master nodes that receive the message will mark the XXX master node as a fail state.

Features of Redis master-slave mode:

A Master can have multiple SlavesUnder the default configuration, the master node can read and write, The slave node can only perform read operations, and write operations are prohibited

Do not modify the configuration to allow the slave node to support write operations. It is meaningless, because first, the data written will not be synchronized to other nodes. Secondly, when the master After a node modifies the same piece of data, the data of the slave node will be overwritten.

If the slave node hangs up, it will not affect the reading and writing of other slave nodes and the reading and writing of the master node. After restarting, the data will be synchronized from the master node. Come here

After the master node hangs up, the reading of the slave node will not be affected. Redis will no longer provide write services. After the master node is started, Redis will provide write services to the outside world again.

After the master node passes, a new master will not be selected from the slave node.

Explanation of password: When the master node sets a password: #########* The client needs a password to access the master; ######* It is required to start the slave The password can be configured in the configuration; ######* No password is required for client access to slave######For more Redis-related technical articles, please visit ###Getting Started Tutorial on Using Redis Database### Column for learning! ###

The above is the detailed content of Is redis master-slave mode a cluster?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn