I have dockerized images of redis (as official dockerhub guides when using custom redis.conf) and custom image (based on alpine image see here: https://pastebin.com/9WsMk1JC ) of sentinel (also with custom sentinel.conf).
In redis.conf, those three parameters was added (rest stays as default conf file):
masterauth password
masteruser default
requirepass password
In sentinel.conf, because of separation of redis instance (other containers) and sentinel is set up to boot up with non existing master on localhost. I've added parameters to perform auth on master. So config file have two additional parameters (rest stays as default conf file):
sentinel auth-pass mymaster password
sentinel auth-user mymaster default
After redis container is booted and ready for connections I start sentinel image, when it's done I connect to redis CLI on sentinel port and switch master by hand:
redis-cli -p 26379 sentinel remove mymaster && redis-cli -p 26379 sentinel monitor mymaster <redis container ip> 6379 2
sentinel's CLI returns OK two times but after a while it prints out that master is down. And it stays in this status forever.
Connectivity between containers tested via telnet and ping - OK.
My guess is that redis sentinel cannot connect to master - because of password.
Why?
- Replicas of redis container - making couple of image copies running and joining them in MASTER-SLAVE via CLI works like a charm. Containers can talk to each other using password from redis.conf.
- Before introducing passwords to redis contianers, sentinels could connect and perform successful failovers.
- Worked on Openshift without password setup.