0

I am a newbie to Docker swarm. I was trying to deploy redis cluster on Docker swarm with compose file. I want the redis cluster use port 6380 so I configured the port and made it mount the redis configure file in compose file.

But when I ran docker stack deploy --compose-file docker-compose.yml node, I got an erro states that "Sorry, the cluster configuration file redis-node.conf is already used by a different Redis Cluster node. Please make sure that different nodes use different cluster configuration files."

Here is my docker-compose.yml

version: "3"

services:

  redis-node:
    image: redis:3.2
    ports:
      - 6380
    deploy:
      replicas: 6
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure
    volumes:
      - /var/docker/redis/node:/data
    command:
      redis-server --port 6380 --logfile redis-node.log --appendonly yes --appendfilename redis-node.aof --appendfsync everysec --cluster-enabled yes --cluster-config-file redis-node.conf
    restart: always

How can I deploy redis cluster mounted with redis.conf in Docker swarm mode?

张云帆
  • 23
  • 6

1 Answers1

0

From the redis cluster docs:

cluster-config-file : Note that despite the name of this option, this is not an user editable configuration file, but the file where a Redis Cluster node automatically persists the cluster configuration (the state, basically) every time there is a change, in order to be able to re-read it at startup.

Are you sharing the volume where this is saved across the cluster? That would seem to be the problem.

sas
  • 7,017
  • 4
  • 36
  • 50