I tried to create Redis cluster in a swarm cluster with 6 nodes, but it becomes infinite wait
-
My servers:
docker-swarm-1 192.168.56.101
docker-swarm-2 192.168.56.102
docker-swarm-3 192.168.56.103
docker-swarm-4 192.168.56.104
docker-swarm-5 192.168.56.105
docker-swarm-6 192.168.56.106 -
Create Docker network
docker network create --driver overlay rediscluster
-
Create Docker service for Redis
docker service create
–name redis_6379
–network rediscluster
–publish=6379:6379
–replicas=6
–mount type=bind,src=/redis/redis_6379/,target=/data/
redis redis-server /data/redis.conf -
Add more port pairing to Docker service for Redis cluster
docker service update --publish-add 16379:16379 redis_6379
- Create Redis cluster
docker run -i --rm ruby sh -c '\
gem install redis
&& wget http://download.redis.io/redis-stable/src/redis-trib.rb
&& ruby redis-trib.rb create --replicas 1 192.168.56.101:6379 192.168.56.102:6379 192.168.56.103:6379 192.168.56.104:6379 192.168.56.105:6379 192.168.56.106:6379’
- Result:
The last step always become a infinite wait.
“Waiting for the cluster to join…”
To troubleshoot, I logon to the docker container and verified the Redis cluster port 16379 is accessible among the Docker container.
Can someone advise me which part has went wrong?
This procedure works when I used docker-compose, instead of Docker swarm.