Home  >  Article  >  Database  >  Does the redis cluster need to set up sentinels?

Does the redis cluster need to set up sentinels?

(*-*)浩
(*-*)浩Original
2019-11-23 09:27:046439browse

Does the redis cluster need to set up sentinels?

Sentinel mode is the officially recommended cluster deployment method of Redis. Unlike the master-slave replication method, the sentinel mode can be automatically implemented when the Master is down. Active/standby switching. The sentinel itself is also an independently running process, which is used to monitor multiple master-slave replication clusters.                                                                                                                                                                                                                                     (Recommended learning: Redis Video Tutorial)

Advantages

Monitor whether the Redis cluster is running well from time to time.

If the Redis node fails, it can immediately work with other processes, such as the client.

Able to automatically switch between active and standby processes.

Sentinel Cluster

Obviously, the sentinel process also has the problem of single-point deployment. That is, after the sentinel process hangs up, the entire cluster becomes unavailable, so the sentinel process also becomes unavailable. Cluster deployment should be supported. The advantages of deploying a sentinel cluster are as follows:

Even if some sentinel processes die, active/standby switching can still be performed.

The client can connect to any sentinel process service to obtain cluster information.

Overview of Sentinel Mode

Sentinel mode is a special mode. First, Redis provides sentinel commands. Sentinel is an independent process. As a process, it will Operate independently. The principle is that the sentinel monitors multiple running Redis instances by sending commands and waiting for the Redis server to respond.

Does the redis cluster need to set up sentinels?

The sentry here has two functions

By sending commands, the Redis server returns to monitor its running status, including the main server and slave server.

When Sentinel detects that the master is down, it will automatically switch the slave to the master, and then notify other slave servers through the publish and subscribe mode, modify the configuration file, and let them switch hosts.

However, problems may arise when a sentinel process monitors the Redis server. For this reason, we can use multiple sentinels for monitoring. Each sentinel will also be monitored, thus forming a multi-sentinel mode.

For more Redis-related technical articles, please visit the Introduction to Using Redis Database Tutorial column to learn!

The above is the detailed content of Does the redis cluster need to set up sentinels?. 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