use embedded clickhouse keeper
This commit is contained in:
parent
1cc35d5ce2
commit
4ae9541259
|
@ -1,6 +1,6 @@
|
||||||
# Local Clickhouse Cluster with Docker Compose
|
# Local Clickhouse Cluster with Docker Compose
|
||||||
|
|
||||||
Sets up a local Clickhouse cluster with 3 nodes (and Zookeeper as a bonus).
|
Sets up a local Clickhouse cluster with 3 nodes (with embedded Clickhouse Keeper as a replacement for Zookeeper).
|
||||||
|
|
||||||
To run it:
|
To run it:
|
||||||
|
|
||||||
|
|
12
config.xml
12
config.xml
|
@ -23,8 +23,16 @@
|
||||||
|
|
||||||
<zookeeper>
|
<zookeeper>
|
||||||
<node>
|
<node>
|
||||||
<host>zookeeper</host>
|
<host>ch1</host>
|
||||||
<port>2181</port>
|
<port>9181</port>
|
||||||
|
</node>
|
||||||
|
<node>
|
||||||
|
<host>ch2</host>
|
||||||
|
<port>9181</port>
|
||||||
|
</node>
|
||||||
|
<node>
|
||||||
|
<host>ch3</host>
|
||||||
|
<port>9181</port>
|
||||||
</node>
|
</node>
|
||||||
</zookeeper>
|
</zookeeper>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
services:
|
services:
|
||||||
ch1:
|
ch1:
|
||||||
image: clickhouse/clickhouse-server:22.8.1
|
image: clickhouse/clickhouse-server:23.1.3
|
||||||
restart: on-failure:10
|
restart: on-failure:10
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
||||||
- ./macro1.xml:/etc/clickhouse-server/config.d/macros.xml
|
- ./macro1.xml:/etc/clickhouse-server/config.d/macros.xml
|
||||||
|
- ./keeper1.xml:/etc/clickhouse-server/config.d/keeper.xml
|
||||||
- ch1data:/var/lib/clickhouse
|
- ch1data:/var/lib/clickhouse
|
||||||
ports:
|
ports:
|
||||||
- '18123:8123'
|
- '18123:8123'
|
||||||
|
@ -20,15 +21,13 @@ services:
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
depends_on:
|
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
ch2:
|
ch2:
|
||||||
image: clickhouse/clickhouse-server:22.8.1
|
image: clickhouse/clickhouse-server:23.1.3
|
||||||
restart: on-failure:10
|
restart: on-failure:10
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
||||||
- ./macro2.xml:/etc/clickhouse-server/config.d/macros.xml
|
- ./macro2.xml:/etc/clickhouse-server/config.d/macros.xml
|
||||||
|
- ./keeper2.xml:/etc/clickhouse-server/config.d/keeper.xml
|
||||||
- ch2data:/var/lib/clickhouse
|
- ch2data:/var/lib/clickhouse
|
||||||
ports:
|
ports:
|
||||||
- '28123:8123'
|
- '28123:8123'
|
||||||
|
@ -45,16 +44,15 @@ services:
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
depends_on:
|
depends_on:
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
ch1:
|
ch1:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ch3:
|
ch3:
|
||||||
image: clickhouse/clickhouse-server:22.8.1
|
image: clickhouse/clickhouse-server:23.1.3
|
||||||
restart: on-failure:10
|
restart: on-failure:10
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
- ./config.xml:/etc/clickhouse-server/config.d/local.xml
|
||||||
- ./macro3.xml:/etc/clickhouse-server/config.d/macros.xml
|
- ./macro3.xml:/etc/clickhouse-server/config.d/macros.xml
|
||||||
|
- ./keeper3.xml:/etc/clickhouse-server/config.d/keeper.xml
|
||||||
- ch3data:/var/lib/clickhouse
|
- ch3data:/var/lib/clickhouse
|
||||||
ports:
|
ports:
|
||||||
- '38123:8123'
|
- '38123:8123'
|
||||||
|
@ -71,19 +69,9 @@ services:
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
depends_on:
|
depends_on:
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
ch1:
|
ch1:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
zookeeper:
|
|
||||||
image: zookeeper:3.8.0
|
|
||||||
restart: on-failure:10
|
|
||||||
healthcheck:
|
|
||||||
test: [ "CMD", "sh", "-c", "nc -nz 127.0.0.1 2181" ]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 3
|
|
||||||
start_period: 30s
|
|
||||||
volumes:
|
volumes:
|
||||||
ch1data:
|
ch1data:
|
||||||
ch2data:
|
ch2data:
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<clickhouse>
|
||||||
|
<keeper_server>
|
||||||
|
<tcp_port>9181</tcp_port>
|
||||||
|
<server_id>1</server_id>
|
||||||
|
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
|
||||||
|
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
|
||||||
|
|
||||||
|
<coordination_settings>
|
||||||
|
<operation_timeout_ms>10000</operation_timeout_ms>
|
||||||
|
<session_timeout_ms>30000</session_timeout_ms>
|
||||||
|
<raft_logs_level>trace</raft_logs_level>
|
||||||
|
</coordination_settings>
|
||||||
|
|
||||||
|
<raft_configuration>
|
||||||
|
<server>
|
||||||
|
<id>1</id>
|
||||||
|
<hostname>ch1</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>2</id>
|
||||||
|
<hostname>ch2</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>3</id>
|
||||||
|
<hostname>ch3</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
</raft_configuration>
|
||||||
|
</keeper_server>
|
||||||
|
</clickhouse>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<clickhouse>
|
||||||
|
<keeper_server>
|
||||||
|
<tcp_port>9181</tcp_port>
|
||||||
|
<server_id>2</server_id>
|
||||||
|
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
|
||||||
|
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
|
||||||
|
|
||||||
|
<coordination_settings>
|
||||||
|
<operation_timeout_ms>10000</operation_timeout_ms>
|
||||||
|
<session_timeout_ms>30000</session_timeout_ms>
|
||||||
|
<raft_logs_level>trace</raft_logs_level>
|
||||||
|
</coordination_settings>
|
||||||
|
|
||||||
|
<raft_configuration>
|
||||||
|
<server>
|
||||||
|
<id>1</id>
|
||||||
|
<hostname>ch1</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>2</id>
|
||||||
|
<hostname>ch2</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>3</id>
|
||||||
|
<hostname>ch3</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
</raft_configuration>
|
||||||
|
</keeper_server>
|
||||||
|
</clickhouse>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<clickhouse>
|
||||||
|
<keeper_server>
|
||||||
|
<tcp_port>9181</tcp_port>
|
||||||
|
<server_id>3</server_id>
|
||||||
|
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
|
||||||
|
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
|
||||||
|
|
||||||
|
<coordination_settings>
|
||||||
|
<operation_timeout_ms>10000</operation_timeout_ms>
|
||||||
|
<session_timeout_ms>30000</session_timeout_ms>
|
||||||
|
<raft_logs_level>trace</raft_logs_level>
|
||||||
|
</coordination_settings>
|
||||||
|
|
||||||
|
<raft_configuration>
|
||||||
|
<server>
|
||||||
|
<id>1</id>
|
||||||
|
<hostname>ch1</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>2</id>
|
||||||
|
<hostname>ch2</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>3</id>
|
||||||
|
<hostname>ch3</hostname>
|
||||||
|
<port>9444</port>
|
||||||
|
</server>
|
||||||
|
</raft_configuration>
|
||||||
|
</keeper_server>
|
||||||
|
</clickhouse>
|
Loading…
Reference in New Issue