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

Windows configure redis Sentinel

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

Share

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

Redis master-slave mode must have a single point of problem, so redis's sentinel mechanism is to make up for this problem. Next, let's configure redis sentinels in Windows environment.

1. Download Windows version of redis address: https://github.com/MicrosoftArchive/redis/releases

two。 Extract to directory, 6379 master, 6380 6381slave

3.redis master-slave configuration

3.1 master file configuration redis.windows.conf

Port 6379

3.2 6380 slave File configuration redis.windows.conf

Port 6380

Slaveof 127.0.0.1 6379

6381 slave File configuration redis.windows.conf

Port 6381

Slaveof 127.0.0.1 6379

4.redis Sentinel configuration

Create a text sentinel.conf file in each redis directory

4.1 the sentinel.conf file for master 6379 is configured as follows

# the port port 26379#master#Sentinel on which the Sentinel service is running monitors a primary redis instance named mymaster. The IP address of this master instance is 127.0.0.1, and the port number is 6379Magi #. To judge this master instance as invalid requires the consent of at least two Sentinel processes, as long as the number of Sentinel is not up to standard. Automatic failover will not execute sentinel monitor master 127.0.0.1 6381, which specifies the number of milliseconds that Sentinel considers the Redis instance to have expired. When an instance does not return PING after that time, or returns an error directly, Sentinel marks the instance as subjectively offline. # only one Sentinel process marks an instance as subjective offline does not necessarily cause automatic failover of the instance: only after a sufficient number of Sentinel marks an instance as subjective offline will the instance be marked as objective offline. Only then will the automatic failover perform sentinel down-after-milliseconds master 500 offline specifying the maximum number of Redis instances that can synchronize new primary instances when performing a failover. In the case of more Redis instances, the smaller the number, the longer the synchronization time, the longer the time it takes to complete the failover. If the failover operation is not completed within that time (ms), the failover is considered to have failed sentinel leader-epoch master 13

4.2 sentinel.conf file configuration in slave 6380

Port 26479

# slave1

Sentinel monitor master 127.0.0.1 6381 1

Sentinel down-after-milliseconds master 5000

Sentinel config-epoch master 12

Sentinel leader-epoch master 13

4.3 sentinel.conf file configuration in slave 6381

Port 26579

# slave2

Sentinel monitor master 127.0.0.1 6381 1

Sentinel down-after-milliseconds master 5000

Sentinel config-epoch master 12

Sentinel leader-epoch master 13

5. Start the redis service

Redis-server.exe redis.windows.conf-master

Redis-server.exe redis.windows.conf-slave

Redis-server.exe redis.windows.conf-slave

6. Test the redis service

7. Start the Sentinel Service.

Redis-server.exe sentinel.conf-sentinel

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