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

How to use Redis Sentinel

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

Share

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

In this issue, the editor will bring you about the use of Redis Sentinel, analyze and describe it from a professional point of view. I hope you can get something after reading this article.

Redis Sentinel is a distributed architecture (the distribution here refers to the architecture in which Redis data nodes, Sentinel nodes and clients are distributed in multiple physical nodes), which includes several Sentinel nodes and Redis data points. Each Sentinel node monitors the data node and the rest of the Sentinel nodes. When it finds that the node is unreachable, it will sign off the node.

If it is identified as the master node, it will also "negotiate" with other Sentinel nodes. When most Sentinel nodes think that the master node is unreachable, they will elect a Sentinel node to complete the automatic failover and notify the Redis application party of the change in real time.

The whole process is completely automatic and does not require human intervention, so this scheme effectively solves the problem of high availability of Redis.

Redis Sentinel has the following functions:

Monitoring (Monitoring): the Sentinel node periodically checks whether the Redis data nodes (including master and slave) and the remaining Sentinel nodes are reachable.

Notification: the Sentinel node notifies the application of the result of the failover.

Automatic failover (Automatic failover): when the master does not work properly, the Sentinel will promote the slave node to the master node and maintain the correct master-slave relationship.

Configuration provider (Configuration provider.): in the Redis Sentinel structure, the client connects to the Sentinel node collection at initialization time to get the master node information.

Redis & the start of Redis Sentinel

Modify in the configuration file. In general, at least three sentinels are needed to monitor redis, and we can start multiple sentinel services by modifying the port.

Configure the ip and port of the master server. We modify the listening port to 6380, and add a weight of 2. The weight here is used to calculate which server we need to upgrade to the master server.

After Redis is installed, we can start Redis and Redis Sentinel (Sentinel) with the following command

# use the default configuration file. / src/redis-server.. / redis.conf# use the default configuration file. / src/redis-sentinel.. / sentinel.conf above is the use of Redis Sentinel shared by the editor. If you have similar doubts, you might as well refer to the above method to try. If you want to know more about it, please follow the industry information.

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