Recently, when building the Redis-sentinel test, you will encounter problems in this label. Deployment: Three Sentinel instances, Port: 36379,36380,36381, Place Sentinel configuration files in the same directory. Results running Sentinel Masters obtained the other sentinels has been 0. Found the next reason on the Internet, did not find. Then I asked my colleague for help, and I found that the IDs of the three Sentinel implementations were identical. As shown in . The initial suspicion is that Sentinel does not support the same directory, so I manually modified the [Sentinel myID] Configuration entry for the sentinel.conf file, using Sentinel Masters to see the other Sentinels is 2. Everything is fine. However, when I kill Mastera, the master with Sentinel Get-master-addr-by-name Mastera does not change. Suspect is the same directory reason, After I put the configuration file in 3 directories, Sentinel master switch back to normal . below I will list the configuration file. Port 36379dir "/usr/local/etc/redis" Sentinel Monitor Mastera 127.0.0.1 16380 2sentinel failover-timeout mastera 6000sentinel auth-pass Mastera xxxxxxxxx The other two profiles are just different port numbers The Redis configuration file is as follows: Drwxr-xr-x Wangtingwei admin 748B 09:46. drwxrwxr-x 8 Wangtingwei Admin 272B 11 24 16:39 ... -rw-r--r--1 Wangtingwei admin 84K one 09:44 16379stdout-rw-r--r--1 Wangtingwei admin 483K one 09:46 16380stdout-rw-r --r--1 Wangtingwei admin 405K one 09:46 16381stdout-rw-r--r--1 Wangtingwei admin 157B one 18:12 dump.rdb-rw-r--r--1 Wangtingwei Admin 211B 11 26 09:44 redis-16369.rdb-rw-r--r--1 Wangtingwei admin 428B 17:11 redis-16379.conf-rw-r--r--1 Wangtingwei admin 404B 09:45 redis-16380.conf-rw-r--r--1 Wangtingwei admin 211B 09:46 redis-16380.rdb-rw-r--r--1 Wangtingwei Admin 435B 09:45 redis-16381.conf-rw-r--r--1 Wangtingwei admin 211B one 09:46 redis-16381.rdb-rw-r--r--1 Wangtingwei A DMin 373B 14:21 redis-26379.conf-rw-r--r--1 Wangtingwei admin 160B one 16:47 redis-26379.rdb-rw-r--r--1 wangting Wei Admin 409B 14:21 redis-26380.conf-rw-r--r--1 Wangtingwei admin 160B one 16:53 redis-26380.rdb-rw-r--r--1 wan Gtingwei admin 414B 16:52 redis-26381.conf-rw-r--r--1 Wangtingwei admin 160B one 22:28 redis-26381.rdbdrwxr-xr-x 3 Wangtingwei admin 102B 18:22 sentinel-36379drwxr-xr-x 3 Wangtingwei admin 102B one 09:36 sentinel-36380drwxr-xr- X 3 Wangtingwei Admin 102B 09:36 sentinel-36381-rw-r--r--1 Wangtingwei admin 26M one 17:07 stdout daemonize Nopidfile/usr/local/etc/redis/redis-16369.pidport 16379#bind 127.0.0.1timeout 300loglevel verboselogfile 16379stdoutdatabases 16save 900 1save 10save 100000rdbcompression yesdbfilename Redis-16369.rdbdir/usr/local/etc/redismasterauth Xxxxxrequirepass xxxxxmaxclients 128maxmemory 0appendonly noappendfilename append-16369.aofappendfsync everysec# vm-enabled no#glueoutputbuf yes daemonize nopidfile "/usr/local/etc/redis/redis-16380.pid" Port 16380# Bind 0.0.0.0timeout 300loglevel debuglogfile "16380stdout" databases 16save + 1save 10save + 10000rdbcompression Yes Dbfilename "Redis-16380.rdb" dir "/usr/local/etc/redis" masterauth "xxxxx" Requirepass "xxxxx" maxclients 128maxmemory 0appendonly noappendfilename "append-16380.aof" Appendfsync everysec
Redis-sentinel test Environment setup (MAC)