AliyunContainerService / redis-cluster

HA Redis Cluster with Sentinel by Docker Compose
Apache License 2.0
458 stars 203 forks source link

howto make "redis-server --slaveof" work for redis node with protected mode #4

Closed crossz closed 8 years ago

crossz commented 8 years ago

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 8 years ago

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 8 years ago

nice!

crossz commented 8 years ago

but it seems can not do failover correctly after the redis-master recovered.......

crossz commented 8 years ago

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