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

The function of Sentinel Node in Redis

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "the role of Sentinel nodes in Redis". In daily operation, I believe that many people have doubts about the role of Sentinel nodes in Redis. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the role of Sentinel nodes in Redis". Next, please follow the editor to study!

Because the Sentinel node is a special Redis node, it has its own dedicated API. Let's take a look at the API usage of the Sentinel node in detail.

1.sentinel masters

The job of this command is to display the status of all monitored master nodes and related statistics. Because the Sentinel node is a special Redis node, I can connect directly to the redis-cli client.

The first step is to start the sentinel node:

. / src/redis-sentinel redis-26379.conf

And then execute

Sentinel masters

The command displays the information of the monitored master node. The following figure shows the results returned by this command.

2.sentinel master

Displays the status and statistics of the primary node.

Sentinel master mymaster

3.sentinel slaves

The status and statistics of the slave node displayed.

Sentinel slaves mymaster

4.sentinel sentinels

Displays the specified collection of Sentinel nodes.

Sentinel sentinels mymaster

5.sentinel get-master-addr-by-name

Returns the IP address and port of the specified primary node.

Sentinel get-master-addr-by-name mymaster

6.sentinel reset

The current Sentinel node resets the configuration that conforms to the master node, including clearing the relevant state of the master node and rediscovering the slave node and the Sentinel node.

Sentinel reset mymaster

7.sentinel failover

The mandatory failover of the designated primary node does not need to negotiate with other Sentinel nodes. When the failover is completed, the other Sentinel nodes update their configuration according to the result of the failover.

Sentinel failover mymaster

8.sentinel ckquorum

The number that detects whether the current total number of reachable Sentinel nodes has reached. For example, when quorum=3, and the current number of reachable Sentinel nodes is 2, then there will be no failover.

Sentinel ckquorum mymaster

9.sentinel flushconfig

Force the configuration of the Sentinel node to flush to disk.

Sentinel flushconfig

10.sentinel remove

Cancels the monitoring of the current Sentinel node for the specified primary node.

Sentinel remove mymaster

11.sentinel monitor

This command has exactly the same meaning as in the configuration file, except that the Sentinel node monitors the master node in the form of a command.

Sentinel monitor mymaster 127.0.0.1 6379 2

12.sentinel set

Dynamically modify Sentinel node configuration options.

Sentinel set mymaster at this point, the study on "the role of Sentinel nodes in Redis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report