I need to create a redis cluster environment in docker with 6 redis nodes deployed in 2 different servers, each with 3 nodes.
sample docker-compose.yml
version: '3.8'
networks:
redis-cluster:
driver: overlay
external: true
services:
redis-node-1:
image: redis:7.0
container_name: redis-node-1
volumes:
- ./config/redis-node1.conf:/usr/local/etc/redis/redis.conf
- ./data/redis-node1:/data
- ./logs/redis-node1:/var/log/redis
ports:
- "7001:6379"
- "17001:16379"
networks:
redis-cluster:
ipv4_address: 172.18.0.11
command: redis-server /usr/local/etc/redis/redis.conf
redis-node1.conf
port 6379
bind 0.0.0.0
cluster-announce-ip 172.18.0.11
cluster-enabled yes
cluster-config-file nodes-7001.conf
cluster-node-timeout 5000
appendonly yes
dir /var/lib/redis/7001
logfile /var/log/redis/redis-7001.log
pidfile /var/run/redis-7001.pid
requirepass DevRedis01
masterauth DevRedis01
cluster-require-full-coverage no
I have created a network using following settings
docker swarm init --advertise-addr <server-ip>
docker swarm join --token <your-token> <manager-ip>:2377
docker network create --driver overlay --subnet=172.18.0.0/16 redis-cluster
Getting error as follows while using docker-compose
usert@ugat:sudo docker-compose up -d
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Starting redis-node-5 ... error
Starting redis-node-4 ...
Starting redis-node-6 ...
Starting redis-node-4 ... error
ERROR: for redis-node-5 Cannot start service redis-node-5: network redis-cluster not found
Starting redis-node-6 ... error
ERROR: for redis-node-6 Cannot start service redis-node-6: network redis-cluster not found
ERROR: for redis-node-5 Cannot start service redis-node-5: network redis-cluster not found
ERROR: for redis-node-4 Cannot start service redis-node-4: network redis-cluster not found
ERROR: for redis-node-6 Cannot start service redis-node-6: network redis-cluster not found
ERROR: Encountered errors while bringing up the project.
is there anything I missed while creating the network?
redis-clusterin the docker command instead ofredis-cluster-net? I would also look into that warning in the beginning about not using compose with swarm.