zookeeper-prod docker-compose.yml

文章目录

      • deploy
      • docker-compose.yml

deploy

docker stack deploy zookeeper -c /data/kafka/docker-compose.yml

docker-compose.yml

version: "3"
services:
  zk1:
    image: zookeeper:3.4
    deploy:
      placement:
        constraints:
          - node.hostname==server01.fuwo.com
      restart_policy:
        condition: on-failure
    hostname: zk1
    ports:
      - "2181:2181"
    networks:
      - zookeeper_default
    volumes:
      - zookeeper:/data
      - zookeeper:/datalog
    environment:
      ZOO_MY_ID: 10
      ZOO_MAX_CLIENT_CNXNS: 1024
      ZOO_INIT_LIMIT: 10
      ZOO_SYNC_LIMIT: 5
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zk2:2888:3888 server.3=zk3:2888:3888
  zk2:
    image: zookeeper:3.4
    deploy:
      placement:
        constraints:
          - node.hostname==server02.fuwo.com
      restart_policy:
        condition: on-failure
    hostname: zk2
    ports:
      - "2182:2181"
    networks:
      - zookeeper_default
    volumes:
      - zookeeper:/data
      - zookeeper:/datalog
    environment:
      ZOO_MY_ID: 20
      ZOO_MAX_CLIENT_CNXNS: 1024
      ZOO_INIT_LIMIT: 10
      ZOO_SYNC_LIMIT: 5
      ZOO_SERVERS: server.1=zk1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zk3:2888:3888
  zk3:
    image: zookeeper:3.4
    deploy:
      placement:
        constraints:
          - node.hostname==server03.fuwo.com
      restart_policy:
        condition: on-failure
    hostname: zk3
    ports:
      - "2183:2181"
    networks:
      - zookeeper_default
    volumes:
      - zookeeper:/data
      - zookeeper:/datalog
    environment:
      ZOO_MY_ID: 30
      ZOO_MAX_CLIENT_CNXNS: 1024
      ZOO_INIT_LIMIT: 10
      ZOO_SYNC_LIMIT: 5
      ZOO_SERVERS: server.1=zk1:2888:3888 server.2=zk2:2888:3888 server.3=0.0.0.0:2888:3888
networks:
  zookeeper_default:
    external: true
volumes:
  zookeeper:
    external: true
    ```


### hosts
```javascript
# hosts1
10.252.93.0 server01 server01.fuwo.com
# hosts2
10.161.210.41 server02 server02.fuwo.com
# hosts3
10.80.179.48 server03 server03.fuwo.com

你可能感兴趣的:(docker)