码迷,mamicode.com
首页 > 其他好文 > 详细

使用Docker 手动&redis-trib.rb方式创建 Redis-Cluster 实验(一)

时间:2019-05-13 11:03:47      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:port   service   contain   ima   idg   slave   compose   2.3   nta   

docker-compose 与 Dockerfile

docker-compose.yaml

version: "3.6"
services:
  redis-master1:
    image: redis-cluster
    container_name: redis-master1
    working_dir: /config
    environment:
      - PORT=6391
    ports:
      - "6391:6391"
      - "16391:16391"
    stdin_open: true
    networks:
      redis-master:
        ipv4_address: 172.50.0.2
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh
  redis-master2:
    image: redis-cluster
    container_name: redis-master2
    working_dir: /config
    environment:
      - PORT=6392
    ports:
      - "6392:6392"
      - "16392:16392"
    stdin_open: true
    networks:
      redis-master:
        ipv4_address: 172.50.0.3
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh
  redis-master3:
    image: redis-cluster
    container_name: redis-master3
    working_dir: /config
    environment:
      - PORT=6393
    ports:
      - "6393:6393"
      - "16393:16393"
    stdin_open: true
    networks:
      redis-master:
        ipv4_address: 172.50.0.4
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh

  redis-slave1:
    image: redis-cluster
    container_name: redis-slave1
    working_dir: /config
    environment:
      - PORT=6394
    networks:
      redis-slave:
        ipv4_address: 172.30.0.2
    ports:
      - "6394:6394"
      - "16394:16394"
    stdin_open: true
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh

  redis-slave2:
    image: redis-cluster
    container_name: redis-slave2
    working_dir: /config
    environment:
      - PORT=6395
    networks:
      redis-slave:
        ipv4_address: 172.30.0.3
    ports:
      - "6395:6395"
      - "16395:16395"
    stdin_open: true
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh

  redis-slave3:
    image: redis-cluster
    container_name: redis-slave3
    working_dir: /config
    environment:
      - PORT=6396
    networks:
      redis-slave:
        ipv4_address: 172.30.0.4
    ports:
      - "6396:6396"
      - "16396:16396"
    stdin_open: true
    tty: true
    privileged: true
    volumes: ["/home/work/docker/six-star/config:/config"]
    entrypoint:
      - /bin/bash
      - redis.sh

networks:
  redis-master:
    driver: bridge
    ipam:
      driver: default
      config:
        -
          subnet: 172.50.0.0/16
  redis-slave:
    driver: bridge
    ipam:
      driver: default
      config:
        -
          subnet: 172.30.0.0/16
  redis-test:
    external:
      name: mynetwork

使用Docker 手动&redis-trib.rb方式创建 Redis-Cluster 实验(一)

标签:port   service   contain   ima   idg   slave   compose   2.3   nta   

原文地址:https://blog.51cto.com/laok8/2393363

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!