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 understand Redis sentinel

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

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to talk to you about how to understand Redis sentinel. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

Three Master, port number 7001, 7002, 7003

Three Slave, port number 7004, 7005, 7006

Two Sentinel port numbers 26378, 26379

Sentinel.conf

Port 26379

Dir tmp

Sentinel monitor mymaster1 127.0.0.1 7001 2

Sentinel monitor mymaster2 127.0.0.1 7002 2

Sentinel monitor mymaster3 127.0.0.1 7003 2

Sentinel down-after-milliseconds mymaster1 60000

Sentinel down-after-milliseconds mymaster2 60000

Sentinel down-after-milliseconds mymaster3 60000

Sentinel failover-timeout mymaster1 180000

Sentinel failover-timeout mymaster2 180000

Sentinel failover-timeout mymaster3 180000

Sentinel parallel-syncs mymaster1 1

Sentinel parallel-syncs mymaster2 1

Sentinel parallel-syncs mymaster3 1

Start sentinel: redis-server.exe sentinel.conf-- sentinel

The two sentinel will automatically detect each other. Sentinel also automatically updates its configuration file, sentinel.conf. After 7001 is dead, 7004 will automatically become a Master. When 7001 restarts, it will become 7004 Slave.

Open the console and connect to any Master.

Redis-cli.exe-p 7001

Check out cluster: cluster nodes. View the current master and slave situation.

127.0.0.1 7001 > cluster nodes

F9a8e70b86f97657acce42bbf7143461fab4c084 127.0.0.1 f9a8e70b86f97657acce42bbf7143461fab4c084 7006 master-0 1489736323181 10 connected 10923-16383

92e1f52348fe604111f28383475fd6df9dee6a69 127.0.0.1:7005 slave c527cf1c31320a8ee26e38307c6f021e752ecda5 0 1489736325189 5 connected

F24d0ebfceb510f2d184035c27bc2e51bd90541f 127.0.0.1:7003 slave f9a8e70b86f97657acce42bbf7143461fab4c084 0 1489736324187 10 connected

E05e709dc82748f54dc1fcd7c99b2084706e0e7b 127.0.0.1 connected 7001 myself,master-001 connected 0-5460

C527cf1c31320a8ee26e38307c6f021e752ecda5 127.0.0.1 c527cf1c31320a8ee26e38307c6f021e752ecda5 7002 master-0 1489736322174 2 connected 5461-10922

80903df75d08e00368513c267b416365070b2286 127.0.0.1:7004 slave e05e709dc82748f54dc1fcd7c99b2084706e0e7b 0 1489736321170 4 connected

After reading the above, do you have any further understanding of how to understand Redis sentinel? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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