docker-compose搭建redis集群--Cluster模式

2022/1/20 19:12:29

本文主要是介绍docker-compose搭建redis集群--Cluster模式,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

version: '3.8'
services:
  redis-node-master-1:
    image: redis:5.0.14
    container_name: cluster-redis-1
    ports:
      - 6381:6379
      - 16381:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6381 \
      --cluster-announce-bus-port 16381"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis1:/data
  redis-node-master-2:
    image: redis:5.0.14
    container_name: cluster-redis-2
    ports:
      - 6382:6379
      - 16382:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6382 \
      --cluster-announce-bus-port 16382"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis2:/data
  redis-node-master-3:
    image: redis:5.0.14
    container_name: cluster-redis-3
    ports:
      - 6383:6379
      - 16383:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6383 \
      --cluster-announce-bus-port 16383"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis3:/data
  redis-node-slave-1:
    image: redis:5.0.14
    container_name: cluster-redis-1-slave
    ports:
      - 6384:6379
      - 16384:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6384 \
      --cluster-announce-bus-port 16384"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis1-slave:/data
  redis-node-slave-2:
    image: redis:5.0.14
    container_name: cluster-redis-2-slave
    ports:
      - 6385:6379
      - 16385:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6385 \
      --cluster-announce-bus-port 16385"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis2-slave:/data
  redis-node-slave-3:
    image: redis:5.0.14
    container_name: cluster-redis-3-slave
    ports:
      - 6386:6379
      - 16386:16379
    command: "redis-server --requirepass abc123 --masterauth abc123 --appendonly yes \
      --cluster-enabled yes \
      --cluster-config-file nodes.conf \
      --cluster-node-timeout 15000 \
      --cluster-announce-ip 10.24.99.61 \
      --cluster-announce-port 6386 \
      --cluster-announce-bus-port 16386"
    volumes:
      - F:\DockerCluster\redis\cluster\data\redis3-slave:/data


这篇关于docker-compose搭建redis集群--Cluster模式的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程