Redis集群~windows下搭建Sentinel环境及它对主从模式的实际意义

Redis集群~windows下搭建Sentinel环境及它对主从模式的实际意义

学习了:https://www.cnblogs.com/lori/p/5825691.html

https://blog.csdn.net/donggang1992/article/details/50981341

https://blog.csdn.net/ownfire/article/details/51546543

学习了:https://blog.csdn.net/men_wen/article/details/72724406

学习了:https://blog.csdn.net/men_wen/article/details/72724406 windows环境下用这个搭建;

 

哨兵机制;

1,redis下载:下载的地址是:https://pan.baidu.com/s/1dEMCa9z 

2,复制6个,三个redis,三个sentinel

D:Redis-Sentinel>ls -al
total 5140
drwxr-xr-x 1 stono 197121       0 May  7 18:40 .
drwxr-xr-x 1 stono 197121       0 May  7 18:39 ..
drwxr-xr-x 1 stono 197121       0 May  7 19:00 Redis-6379
drwxr-xr-x 1 stono 197121       0 May  7 19:00 Redis-6380
drwxr-xr-x 1 stono 197121       0 May  7 19:00 Redis-6381
-rw-r--r-- 1 stono 197121 5224077 May  7 16:59 Redis-x64-3.2.100.zip
drwxr-xr-x 1 stono 197121       0 May  7 18:49 Sentinel-26379
drwxr-xr-x 1 stono 197121       0 May  7 18:54 Sentinel-26380
drwxr-xr-x 1 stono 197121       0 May  7 18:54 Sentinel-26381

3,修改redis中的config

=====6379文件====

port 6379
requirepass QazEdc123456!
masterauth QazEdc123456!

6379文件里面也加上masterauth吧,感觉可能会有用,当主节点的master状态变动之后;

6380、6381文件一样,注意修改端口;

还需要加上:

slaveof 127.0.0.1 6379

=====26379sentinel.conf文件=====

port 26379
#master-0
sentinel monitor master-0 127.0.0.1 6379 2
sentinel down-after-milliseconds master-0 5000
sentinel auth-pass master-0 QazEdc123456!
sentinel config-epoch master-0 0

2380、26381文件一样,注意修改端口

sentinel启动后会增加一些内容:

sentinel myid f033f87745f732e6e9071809a3b3cf289c4a5b78

# Generated by CONFIG REWRITE
dir "D:\Redis-Sentinel\Sentinel-26379"
sentinel leader-epoch master-0 0
sentinel known-slave master-0 127.0.0.1 6380
sentinel known-slave master-0 127.0.0.1 6381
sentinel known-sentinel master-0 127.0.0.1 26381 509a7fac5ec41e058cd244aa75680948454c662d
sentinel known-sentinel master-0 127.0.0.1 26380 7a1892de605d560c29cd9159d6760148a3fff9df
sentinel current-epoch 0

4,启动

redis启动:

redis-server.exe redis.windows.conf

sentinel启动:

redis-server.exe sentinel.conf --sentinel

 

 

原文地址:https://www.cnblogs.com/stono/p/9003930.html