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

Posted stono

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

 

 

 

以上是关于Redis集群~windows下搭建Sentinel环境及它对主从模式的实际意义的主要内容,如果未能解决你的问题,请参考以下文章

Windows下搭建Redis5.0.9集群

redis介绍 window 下redis的集群

Redis → Windows下搭建redis集群

windows环境下搭建redis集群

在Windows系统下搭建Redis集群

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