howto make "redis-server --slaveof" work for redis node with protected mode
crossz opened this issue · 4 comments
crossz commented
If I use 'redis-server --requirepass XXX' or attach my redis.conf with requirepass directive, I could not make the command of 'redis-server --slaveof' work within the slave container.
do you know how to fix this?
crossz commented
Figure it out.
redis-cli -h slave -a master-password config set masterauth master-password
redis-cli -h slave -a masterpassword slaveof redis-master 6379
denverdino commented
nice!
crossz commented
but it seems can not do failover correctly after the redis-master recovered.......
crossz commented
OK. fix it.
I put the --slaveof into the entrypoint.sh within sentinel.
while the "command" of docker-compose.yml should be like following:
master:
image: redis:3
command: redis-server --requirepass PW --masterauth PW
slave:
image: redis:3
command: redis-server --requirepass PW --masterauth PW
links:
- master:redis-master
sentinel:
build: sentinel
environment:
- SENTINEL_DOWN_AFTER=5000
- SENTINEL_FAILOVER=5000
- REQUIREPASS=PW
links:
- master:redis-master
- slave