My Environment
- mac os ventura 13.6.3
- Docker version 20.10.21
What I want to do
Hi guys, I want to run redis cluster with docker compose. and without extra redis.conf file (so I passed the configuration through cli argument)
docker-compose.yml
version: '3'
services:
redis1:
image: redis
ports:
- "7101:7101"
- "17101:17101"
command: redis-server --port 7101 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
redis2:
image: redis
ports:
- "7102:7102"
- "17102:17102"
command: redis-server --port 7102 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
redis3:
image: redis
ports:
- "7103:7103"
- "17103:17103"
command: redis-server --port 7103 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
redis4:
image: redis
ports:
- "7104:7104"
- "17104:17104"
command: redis-server --port 7104 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
redis5:
image: redis
ports:
- "7105:7105"
- "17105:17105"
command: redis-server --port 7105 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
redis6:
image: redis
ports:
- "7106:7106"
- "17106:17106"
command: redis-server --port 7106 --bind 0.0.0.0 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 3000 --appendonly yes --appendfilename appendonly.aof
I did docker compose up -d and
redis-cli --cluster create 127.0.0.1:7101 127.0.0.1:7102 127.0.0.1:7103 127.0.0.1:7104 127.0.0.1:7105 127.0.0.1:7106 --cluster-replicas 1
and the result is ...
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 127.0.0.1:7105 to 127.0.0.1:7101
Adding replica 127.0.0.1:7106 to 127.0.0.1:7102
Adding replica 127.0.0.1:7104 to 127.0.0.1:7103
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 45ba4e5d18e430befe4c04de8110afd216ded3a3 127.0.0.1:7101
slots:[0-5460] (5461 slots) master
M: 91502a20a87cba0ef0fdfb9267ad8087789d2077 127.0.0.1:7102
slots:[5461-10922] (5462 slots) master
M: 97730e7f548c111b4dc5771b01dcfda44617fe78 127.0.0.1:7103
slots:[10923-16383] (5461 slots) master
S: e0290170552cad6d1854f6c06de023c80e5874a2 127.0.0.1:7104
replicates 97730e7f548c111b4dc5771b01dcfda44617fe78
S: 63917dd749dcbb321809d1cceb9e5b6db4aa9e48 127.0.0.1:7105
replicates 45ba4e5d18e430befe4c04de8110afd216ded3a3
S: 3b9c5db62df1b562b927ee4490670a636f1227a5 127.0.0.1:7106
replicates 91502a20a87cba0ef0fdfb9267ad8087789d2077
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
........................................................................................
could you guys please let me know what I'm missing?