博客园 首页 私信博主 显示目录 隐藏目录 管理 动画

基于docker-compose安装redis同步

编写yaml文件

version: '3.4'
services:
  master:
    image: redis
    container_name: redis-master
    restart: always
    command: redis-server --port 6379 --requirepass 1234
#    network_mode: "host"
    ports:
      - 6379:6379

  slave1:
    image: redis
    container_name: redis-slave-1
    restart: always
    command: redis-server --slaveof 192.168.16.104 6379 --port 6380 --requirepass 1234 --masterauth 1234
#    network_mode: "host"
    ports:
      - 6380:6380


  slave2:
    image: redis
    container_name: redis-slave-2
    restart: always
    command: redis-server --slaveof 192.168.16.104 6379 --port 6381 --requirepass 1234 --masterauth 1234
#    network_mode: "host"
    ports:
      - 6381:6381
posted @ 2021-06-08 15:49  ants_double  阅读(71)  评论(0编辑  收藏  举报