REDIS-sentinel测试环境搭建(MAC)

最近在搭建Redis-Sentinel测试时,将遇到的问题在这标注下.部署:三个Sentinel实例,端口为:36379,36380,36381,将Sentinel配置文件放在同一目录下.结果运行Sentinel masters得到的Other sentinels一直为0.在网上找了下原因,没有找到.然后我截图向同事求助,截图后发现三个Sentinel实现的ID竟然一致.如下图所示.
201711282124.jpg
201711282125.jpg

201711282125.jpg

初步怀疑是Sentinel不不⽀支持同⼀一⽬目录,于是我⼿手⼯工修改sentinel.conf⽂文件的[sentinel

myid] 配置项,使⽤用Sentinel masters可以看到other sentinels为2了了.⼀一切正常.

然⽽而当我KILL掉mastera时,使⽤用Sentinel get-master-addr-by-name mastera得

到的master没有变化.怀疑⼜又是相同⽬目录原因,后我将配置⽂文件置于3个⽬目

录,Sentinel主从切换恢复正常.

下⾯面我将配置⽂文件列列出.

port 36379

dir "/usr/local/etc/redis"

sentinel monitor mastera 127.0.0.1 16380 2

sentinel failover-timeout mastera 6000

sentinel auth-pass mastera xxxxxxxxx

另外两个配置⽂文件只是端⼝口号不不同

redis配置⽂文件如下:

drwxr-xr-x 22 wangtingwei admin 748B 11 26 09N46 .

drwxrwxr-x 8 wangtingwei admin 272B 11 24 16N39 ..

-rw-r--r-- 1 wangtingwei admin 84K 11 26 09N44 16379stdout

-rw-r--r-- 1 wangtingwei admin 483K 11 26 09N46 16380stdout

-rw-r--r-- 1 wangtingwei admin 405K 11 26 09N46 16381stdout

-rw-r--r-- 1 wangtingwei admin 157B 11 22 18N12 dump.rdb

-rw-r--r-- 1 wangtingwei admin 211B 11 26 09N44 redis-16369.rdb

-rw-r--r-- 1 wangtingwei admin 428B 11 24 17N11 redis-16379.conf

-rw-r--r-- 1 wangtingwei admin 404B 11 26 09N45 redis-16380.conf

-rw-r--r-- 1 wangtingwei admin 211B 11 26 09N46 redis-16380.rdb

-rw-r--r-- 1 wangtingwei admin 435B 11 26 09N45 redis-16381.conf

-rw-r--r-- 1 wangtingwei admin 211B 11 26 09N46 redis-16381.rdb

-rw-r--r-- 1 wangtingwei admin 373B 11 24 14N21 redis-26379.conf

-rw-r--r-- 1 wangtingwei admin 160B 11 24 16N47 redis-26379.rdb

-rw-r--r-- 1 wangtingwei admin 409B 11 24 14N21 redis-26380.conf

-rw-r--r-- 1 wangtingwei admin 160B 11 24 16N53 redis-26380.rdb

-rw-r--r-- 1 wangtingwei admin 414B 11 24 16N52 redis-26381.conf

-rw-r--r-- 1 wangtingwei admin 160B 11 22 22N28 redis-26381.rdb

drwxr-xr-x 3 wangtingwei admin 102B 11 27 18N22 sentinel-36379

drwxr-xr-x 3 wangtingwei admin 102B 11 26 09N36 sentinel-36380

drwxr-xr-x 3 wangtingwei admin 102B 11 26 09N36 sentinel-36381

-rw-r--r-- 1 wangtingwei admin 26M 11 24 17N07 stdout

daemonize no

pidfile /usr/local/etc/redis/redis-16369.pid

port 16379

#bind 127.0.0.1

timeout 300

loglevel verbose

logfile 16379stdout

databases 16

save 900 1

save 300 10

save 60 100000

rdbcompression yes

dbfilename redis-16369.rdb

dir /usr/local/etc/redis

masterauth xxxxx

requirepass xxxxx

maxclients 128

maxmemory 0

appendonly no

appendfilename append-16369.aof

appendfsync everysec

#vm-enabled no

#glueoutputbuf yes

daemonize no

pidfile "/usr/local/etc/redis/redis-16380.pid"

port 16380

#bind 0.0.0.0

timeout 300

loglevel debug

logfile "16380stdout"

databases 16

save 900 1

save 300 10

save 60 10000

rdbcompression yes

dbfilename "redis-16380.rdb"

dir "/usr/local/etc/redis"

masterauth "xxxxx"

requirepass "xxxxx"

maxclients 128

maxmemory 0

appendonly no

appendfilename "append-16380.aof"

appendfsync everysec

posted @ 2017-11-27 19:58  冰冰与铛铛  阅读(928)  评论(0编辑  收藏  举报