Skip to content

Wrong docker-compose example #72

Closed
@szitnik

Description

I observed that there should be a working example for docker-compose available. I propose to add working docker-compose examples for zookeeper 3.4 and 3.5.

The difference between the two is in ZOO_SERVERS parameter.

Zookeeper 3.4

version: '3.7'

services:
  zookeeper1:
    image: zookeeper:3.4.14
    restart: always
    hostname: zookeeper1
    ports:
      - 2181:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.41
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zookeeper2:2888:3888 server.3=zookeeper3:2888:3888

  zookeeper2:
    image: zookeeper:3.4.14
    restart: always
    hostname: zookeeper2
    ports:
      - 2182:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.42
    environment:
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zookeeper1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zookeeper3:2888:3888

  zookeeper3:
    image: zookeeper:3.4.14
    restart: always
    hostname: zookeeper3
    ports:
      - 2183:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.43
    environment:
      ZOO_MY_ID: 3
      ZOO_SERVERS: server.1=zookeeper1:2888:3888 server.2=zookeeper2:2888:3888 server.3=0.0.0.0:2888:3888

networks:
  zk-network:
    driver: bridge
    ipam:
     driver: default
     config:
       - subnet: 10.1.1.0/24

Zookeeper 3.5

version: '3.7'

services:
  zookeeper1:
    image: zookeeper:3.5.5
    restart: always
    hostname: zookeeper1
    ports:
      - 2181:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.41
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=zookeeper3:2888:3888;2181

  zookeeper2:
    image: zookeeper:3.5.5
    restart: always
    hostname: zookeeper2
    ports:
      - 2182:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.42
    environment:
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zookeeper1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zookeeper3:2888:3888;2181

  zookeeper3:
    image: zookeeper:3.5.5
    restart: always
    hostname: zookeeper3
    ports:
      - 2183:2181
    networks: 
      zk-network:
        ipv4_address: 10.1.1.43
    environment:
      ZOO_MY_ID: 3
      ZOO_SERVERS: server.1=zookeeper1:2888:3888;2181 server.2=zookeeper2:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181

networks:
  zk-network:
    driver: bridge
    ipam:
     driver: default
     config:
       - subnet: 10.1.1.0/24

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions