#redis high availability: If you deploy a master-slave architecture, you just need to add sentinels, and you can achieve it if any instance goes down. , active and standby switching will be performed automatically.
# Sentinel Machine (Recommended learning: redis video tutorial )
After the realization of the master and slam The server is monitored, and a "sentinel" mechanism is provided after redis2.6. As the name suggests, the meaning of sentinel is to monitor the running status of the redis system. Multiple sentinels can be started to monitor the running status of the redis database. Its main functions have two points:
a. Monitor whether all node databases are running normally.
b. When the master database fails, a new master can be automatically elected from the slave node through the voting mechanism to achieve automatic switching from the slave database to the master database.
In a Redis system with one master and multiple slaves, multiple sentinels can be used to perform monitoring tasks to ensure that the system is robust enough. At this time, not only will the sentinel monitor the master database and the slave database at the same time, but the sentinels will also monitor each other. Here, it is recommended that you deploy at least 3 sentries and use an odd number of sentries.
The Sentinel system of Redis is used to manage multiple Redis servers. The system performs the following three tasks:
Monitoring: Sentinel will constantly check whether your Master and Slave are operating normally.
Notification:When there is a problem with a monitored Redis, the sentinel can send notifications to the administrator or other applications through the API.
Automatic failover:When a Master fails to work properly, Sentinel will start an automatic failover operation, and it will upgrade one of the Slaves of the failed Master. As the new Master, and let other Slaves of the failed Master change to copy the new Master; when the client tries to connect to the failed Master, the cluster will also return the address of the new Master to the client, so that the cluster can use the Master to replace the failed Master.
Sentinel is a distributed system. You can run multiple sentinel processes in an architecture. These processes use gossip protocols to receive information about whether the Master is offline information, and use voting protocols (agreement protocols) to decide whether to perform automatic failover and which Slave to choose as the new Master.
Each sentinel will report to other sentinels, The master and slave regularly send messages to confirm whether the other party is "alive". If the other party does not respond within the specified time (configurable), the other party is temporarily considered to be down (the so-called "subjective downtime"). Subjective Down, referred to as sdown ).
If most sentinels in the "Sentinel Group" report that a certain master is not responding, the system will consider the master to be "completely dead" (ie: objectively down, Objective Down, referred to as odown) ), through a certain vote algorithm, select one of the remaining slave nodes to be promoted to master, and then automatically modify the relevant configuration.
Although sentinel is released as a separate executable file redis -sentinel, but in fact it is just a Redis server running in a special mode. You can start sentinel by giving the --sentinel option when starting a normal Redis server.
The above is the detailed content of How to ensure high availability of redis. For more information, please follow other related articles on the PHP Chinese website!

Redis是现在最热门的key-value数据库,Redis的最大特点是key-value存储所带来的简单和高性能;相较于MongoDB和Redis,晚一年发布的ES可能知名度要低一些,ES的特点是搜索,ES是围绕搜索设计的。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于redis的一些优势和特点,Redis 是一个开源的使用ANSI C语言编写、遵守 BSD 协议、支持网络、可基于内存、分布式存储数据库,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis Cluster集群收缩主从节点的相关问题,包括了Cluster集群收缩概念、将6390主节点从集群中收缩、验证数据迁移过程是否导致数据异常等,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis实现排行榜及相同积分按时间排序,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于原子操作中命令原子性的相关问题,包括了处理并发的方案、编程模型、多IO线程以及单命令的相关内容,下面一起看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了bitmap问题,Redis 为我们提供了位图这一数据结构,位图数据结构其实并不是一个全新的玩意,我们可以简单的认为就是个数组,只是里面的内容只能为0或1而已,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis实现排行榜及相同积分按时间排序,本文通过实例代码给大家介绍的非常详细,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于实现秒杀的相关内容,包括了秒杀逻辑、存在的链接超时、超卖和库存遗留的问题,下面一起来看一下,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!
