Hello,
I found out that in Redis Sentinel 3.2.5 we cannot bind more than one IP address (i.e. it binds only to the first ip address).
Here is the configuration that doesn't work (i.e. sentinel starts but can't find master nodes) :
bind 127.0.0.1 192.168.0.18
port 26379
dir /var/lib/redis/sentinel
sentinel monitor master1 192.168.0.14 6379 1
sentinel down-after-milliseconds master1 20000
sentinel parallel-syncs master1 1
sentinel failover-timeout master1 90000
The same configuration which works as expected:
bind 192.168.0.18
port 26379
dir /var/lib/redis/sentinel
sentinel monitor master1 192.168.0.14 6379 1
sentinel down-after-milliseconds master1 20000
sentinel parallel-syncs master1 1
sentinel failover-timeout master1 90000
P.S. I have posted the same issue in the redis group
Sincerely, Alexandr
Comment From: faridsaad
Same problem. My sentinel client wouldn't join the master. After digging a bit since everything in the configuration files looked sane I found this:
[pid 29140] socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 6
[pid 29140] fcntl(6, F_GETFL) = 0x2 (flags O_RDWR)
[pid 29140] fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid 29140] bind(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 29140] connect(6, {sa_family=AF_INET, sin_port=htons(6379), sin_addr=inet_addr("10.14.162.211")}, 16) = -1 EINVAL (Invalid argument)
[pid 29140] close(6) = 0
[pid 29140] gettimeofday({1478903357, 191569}, NULL) = 0
[pid 29140] gettimeofday({1478903357, 191624}, NULL) = 0
[pid 29140] gettimeofday({1478903357, 191698}, NULL) = 0
As soon as I removed 127.0.0.1 from the bind directive things worked as expected.
My configuration was similar to the opening post.
Comment From: eliskovets
Hi guys, It looks like the order of IPs in bind matters and network ip should be on the first place. We've done some experiments and if you have 127.0.0.1 on the first place then redis server is not going to register your sentinel, because it's trying to verify if sentinel is reachable by the first ip address in the bind and if your sentinel is not on the same machine as your redis server then this check fail. Could you please try to change the order in your sentinel config and try again?
Sorry for writing in the old issue, but I guess my comment could be helpful for somebody who face the same issue in future :)
Comment From: fessmage
@eliskovets found you comment when already discovered this behaviour myself.
This is really counter-intuitive, and differs from config example of sentintel and from redis server config. I think this must be written as a warning in redis docs page about sentinel.
Redis version 4.0.9 (from ubuntu 18 repos).
Comment From: Eugeny
Confirmed - the first IP from the bind list is used to announce the Sentinel's own address