From f4efa61cc65ab2085d26ac1a723aabe64c9940dd Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:52:55 +1000 Subject: [PATCH] feat(docker): move to zookeeper --- .../etc/clickhouse-server/config.d/config.xml | 12 ++-- .../etc/clickhouse-server/config.d/config.xml | 12 ++-- .../etc/clickhouse-keeper/keeper_config.xml | 39 ----------- .../etc/clickhouse-keeper/keeper_config.xml | 39 ----------- .../etc/clickhouse-keeper/keeper_config.xml | 39 ----------- docker-compose.yml | 69 +++++++++---------- 6 files changed, 45 insertions(+), 165 deletions(-) delete mode 100644 deploy/local/docker-compose/clickhouse/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml delete mode 100644 deploy/local/docker-compose/clickhouse/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml delete mode 100644 deploy/local/docker-compose/clickhouse/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml diff --git a/deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/config.d/config.xml b/deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/config.d/config.xml index 7b96ce2c..e5a0623e 100644 --- a/deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/config.d/config.xml +++ b/deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/config.d/config.xml @@ -36,16 +36,16 @@ - clickhouse-keeper-01 - 9181 + zookeeper-01 + 2181 - clickhouse-keeper-02 - 9181 + zookeeper-02 + 2181 - clickhouse-keeper-03 - 9181 + zookeeper-03 + 2181 diff --git a/deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/config.d/config.xml b/deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/config.d/config.xml index 569c06f2..f70ca5d6 100644 --- a/deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/config.d/config.xml +++ b/deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/config.d/config.xml @@ -36,16 +36,16 @@ - clickhouse-keeper-01 - 9181 + zookeeper-01 + 2181 - clickhouse-keeper-02 - 9181 + zookeeper-02 + 2181 - clickhouse-keeper-03 - 9181 + zookeeper-03 + 2181 diff --git a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml b/deploy/local/docker-compose/clickhouse/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml deleted file mode 100644 index b27b4805..00000000 --- a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - debug - 1 - - 0.0.0.0 - - 1 - 9181 - /var/lib/clickhouse-keeper - /var/lib/clickhouse/coordination/log - /var/lib/clickhouse/coordination/snapshots - true - * - - - 10000 - 30000 - warning - - - - 1 - clickhouse-keeper-01 - 9234 - - - 2 - clickhouse-keeper-02 - 9234 - - - 3 - clickhouse-keeper-03 - 9234 - - - - diff --git a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml b/deploy/local/docker-compose/clickhouse/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml deleted file mode 100644 index 722a5e3f..00000000 --- a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - debug - 1 - - 0.0.0.0 - - 2 - 9181 - /var/lib/clickhouse-keeper - /var/lib/clickhouse/coordination/log - /var/lib/clickhouse/coordination/snapshots - true - * - - - 10000 - 30000 - warning - - - - 1 - clickhouse-keeper-01 - 9234 - - - 2 - clickhouse-keeper-02 - 9234 - - - 3 - clickhouse-keeper-03 - 9234 - - - - diff --git a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml b/deploy/local/docker-compose/clickhouse/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml deleted file mode 100644 index 506217b2..00000000 --- a/deploy/local/docker-compose/clickhouse/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - debug - 1 - - 0.0.0.0 - - 3 - 9181 - /var/lib/clickhouse-keeper - /var/lib/clickhouse/coordination/log - /var/lib/clickhouse/coordination/snapshots - true - * - - - 10000 - 30000 - warning - - - - 1 - clickhouse-keeper-01 - 9234 - - - 2 - clickhouse-keeper-02 - 9234 - - - 3 - clickhouse-keeper-03 - 9234 - - - - diff --git a/docker-compose.yml b/docker-compose.yml index a60d656b..53a64b70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,11 +20,11 @@ services: - "127.0.0.1:8123:8123" - "127.0.0.1:9000:9000" depends_on: - clickhouse-keeper-01: + zookeeper-01: condition: service_healthy - clickhouse-keeper-02: + zookeeper-02: condition: service_healthy - clickhouse-keeper-03: + zookeeper-03: condition: service_healthy healthcheck: test: @@ -55,11 +55,11 @@ services: - "127.0.0.1:8124:8123" - "127.0.0.1:9001:9000" depends_on: - clickhouse-keeper-01: + zookeeper-01: condition: service_healthy - clickhouse-keeper-02: + zookeeper-02: condition: service_healthy - clickhouse-keeper-03: + zookeeper-03: condition: service_healthy healthcheck: test: @@ -71,62 +71,59 @@ services: timeout: 10s retries: 15 start_period: 15s - clickhouse-keeper-01: + zookeeper-01: profiles: - clickhouse - "" - image: "clickhouse/clickhouse-keeper:23.12-alpine" - user: "101:101" - container_name: clickhouse-keeper-01 - hostname: clickhouse-keeper-01 + image: zookeeper:3.9 + container_name: zookeeper-01 + hostname: zookeeper-01 networks: - xatu-net - volumes: - - ./deploy/local/docker-compose/clickhouse/clickhouse-keeper-01/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml - ports: - - "127.0.0.1:9181:9181" + environment: + ZOO_MY_ID: 1 + ZOO_4LW_COMMANDS_WHITELIST: "*" + ZOO_SERVERS: "server.1=zookeeper-01:2888:3888;2181 server.2=zookeeper-02:2888:3888;2181 server.3=zookeeper-03:2888:3888;2181" healthcheck: - test: ["CMD-SHELL", "echo ruok | nc localhost 9181 | grep -q 'imok'"] + test: ["CMD-SHELL", "echo ruok | nc localhost 2181 | grep -q 'imok'"] interval: 30s timeout: 10s retries: 3 start_period: 5s - clickhouse-keeper-02: + zookeeper-02: profiles: - clickhouse - "" - image: "clickhouse/clickhouse-keeper:23.12-alpine" - user: "101:101" - container_name: clickhouse-keeper-02 - hostname: clickhouse-keeper-02 + image: zookeeper:3.9 + container_name: zookeeper-02 + hostname: zookeeper-02 networks: - xatu-net - volumes: - - ./deploy/local/docker-compose/clickhouse/clickhouse-keeper-02/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml - ports: - - "127.0.0.1:9182:9181" + environment: + ZOO_MY_ID: 2 + ZOO_4LW_COMMANDS_WHITELIST: "*" + ZOO_SERVERS: "server.1=zookeeper-01:2888:3888;2181 server.2=zookeeper-02:2888:3888;2181 server.3=zookeeper-03:2888:3888;2181" healthcheck: - test: ["CMD-SHELL", "echo ruok | nc localhost 9181 | grep -q 'imok'"] + test: ["CMD-SHELL", "echo ruok | nc localhost 2181 | grep -q 'imok'"] interval: 30s timeout: 10s retries: 3 start_period: 5s - clickhouse-keeper-03: + zookeeper-03: profiles: - clickhouse - "" - image: "clickhouse/clickhouse-keeper:23.12-alpine" - user: "101:101" - container_name: clickhouse-keeper-03 - hostname: clickhouse-keeper-03 + image: zookeeper:3.9 + container_name: zookeeper-03 + hostname: zookeeper-03 networks: - xatu-net - volumes: - - ./deploy/local/docker-compose/clickhouse/clickhouse-keeper-03/etc/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml - ports: - - "127.0.0.1:9183:9181" + environment: + ZOO_MY_ID: 3 + ZOO_4LW_COMMANDS_WHITELIST: "*" + ZOO_SERVERS: "server.1=zookeeper-01:2888:3888;2181 server.2=zookeeper-02:2888:3888;2181 server.3=zookeeper-03:2888:3888;2181" healthcheck: - test: ["CMD-SHELL", "echo ruok | nc localhost 9181 | grep -q 'imok'"] + test: ["CMD-SHELL", "echo ruok | nc localhost 2181 | grep -q 'imok'"] interval: 30s timeout: 10s retries: 3