redis cluster 搭建记录。 redis 文档

配置模板

version: '3.7'

services:
  redis6379:
    image:  redis
    container_name: redis
    command:
      ["redis-server", "/usr/local/etc/redis/redis.conf"]
    volumes:
      - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./data:/data
    ports:
      - "6379:6379"
      - "16379:16379"
    environment:
      # 设置时区为上海,否则时间会有问题
      - TZ=Asia/Shanghai
networks:
  default:
    name: kepler
    external: true

redis.conf

bind 0.0.0.0
port 6379
protected-mode no
cluster-enabled yes
cluster-node-timeout 5000
cluster-announce-ip 10.80.115.60
cluster-announce-port 6379
cluster-announce-bus-port 16379
cluster-config-file  nodes.conf
appendonly yes
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb