REDIS-sentinel測試環境搭建(MAC)

最近在搭建Redis-Sentinel測試時,將遇到的問題在這標註下.部署:三個Sentinel實例,端口爲:36379,36380,36381,將Sentinel配置文件放在同一目錄下.結果運行Sentinel masters獲得的Other sentinels一直爲0.在網上找了下緣由,沒有找到.而後我截圖向同事求助,截圖後發現三個Sentinel實現的ID居然一致.以下圖所示.
201711282124.jpg
201711282125.jpg

201711282125.jpgredis

初步懷疑是Sentinel不不⽀支持同⼀一⽬目錄,因而我⼿手⼯工修改sentinel.conf⽂文件的[sentinelapp

myid] 配置項,使⽤用Sentinel masters能夠看到other sentinels爲2了了.⼀一切正常.測試

然⽽而當我KILL掉mastera時,使⽤用Sentinel get-master-addr-by-name mastera得ui

到的master沒有變化.懷疑⼜又是相同⽬目錄緣由,後我將配置⽂文件置於3個⽬目debug

錄,Sentinel主從切換恢復正常.orm

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

port 36379部署

dir "/usr/local/etc/redis"get

sentinel monitor mastera 127.0.0.1 16380 2it

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

相關文章
相關標籤/搜索