Home>Article>Database> Is redis sentinel mode a cluster?

Is redis sentinel mode a cluster?

(*-*)浩
(*-*)浩 Original
2019-11-23 09:36:37 2555browse

Is redis sentinel mode a cluster?

Sentinel mode

It is a highly available solution. Sentinel itself is an independently running process and can be deployed Monitor the Redis cluster on other machines that can communicate with the Redis cluster.

Monitoring: Sentinel will regularly monitor whether redis is running well. (Recommended learning:Redis video tutorial)

Reminder:If the sentinel finds that a redis node is in trouble, it can notify another process (such as his client)

Automatic failover: After the master goes down, a master-backup switch will be performed. When the client attempts to connect to the failed master server, the cluster will also return the address of the new master server to the client, so that the cluster can use the new master server to replace the failed server. If the master recovers, it will become a slave.

Redis Sentinel is a distributed system that uses gossip protocol to receive whether the master is offline, and uses voting protocol to decide whether to perform fault migration (it will be executed when the number of votes exceeds the configured value, and it will be executed when the number of votes exceeds the configured value. It needs to be approved by more than half of the sentinels before it can be executed), and which slave is selected as the master.

Subjective offline: When a sentinel process monitors that the master cannot connect, then it thinks that the master is offline.

Objective offline: When receiving master information from other sentinel processes, determine whether it is truly offline.

Each sentinel sends ping requests to master, slave, and other sentinels every second.

Cluster Mode

Since Sentinel does not support smooth expansion and adding nodes, you have to manually migrate the data. To this end, Reids officially provides Redis Cluster to implement distributed solutions. Distributed clusters first solve the problem of mapping the entire data set to multiple nodes according to partitioning rules, that is, dividing the data set into multiple nodes, and each node is responsible for a subset of the entire data.

I think it is the same as consistent hashing. Now that the hash of the key is calculated and the shards are obtained, the disadvantage of the cluster mode is that batch operations of keys cannot be performed. Because this key may be on different redis instances.

The fault discovery of the cluster is also notified to each redis node through Gossip, and two nodes ping and pong each other.

Deleting and adding nodes requires data migration.

For more Redis-related technical articles, please visit theIntroduction to Using Redis Database Tutorialcolumn to learn!

The above is the detailed content of Is redis sentinel 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