I need to create the replication in clickhouse; on two different machines that are under the same network. I have tried to configure it but I have the following error:
SQL Error [999] [07000]: Code: 999. Coordination::Exception: All connection tries failed while connecting to ZooKeeper. do not give
Server 1: 192.168.101.105 docker-compose.yml
version: '3.8'
services:
clickhouse_demo:
image: yandex/clickhouse-server:latest
container_name: clickhouse-demo
hostname: clickhouse-demo
environment:
- CLICKHOUSE_CONFIG=/etc/clickhouse-server/config.xml
- CLICKHOUSE_PASSWORD=tecate.01
volumes:
- ./clickhouse_demo/config.xml:/etc/clickhouse-server/config.xml
- - ./clickhouse_node/data:/var/lib/clickhouse'
mem_limit: 32g
cpus: "6"
ports:
- "8123:8123"
- "9000:9000"
depends_on:
- clickhouse-keeper-demo
clickhouse-keeper-demo:
image: clickhouse/clickhouse-keeper:latest
container_name: clickhouse-keeper-demo
hostname: clickhouse-keeper-demo
volumes:
- ./clickhouse_keeper_demo/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml
ports:
- "9181:9181"
config.xml
<remote_servers>
<my_cluster>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>192.168.101.105</host>
<port>9000</port>
<user>default</user>
<password>tecate.01</password>
</replica>
</shard>
<shard>
<replica>
<host>192.168.101.104</host>
<port>9000</port>
<user>default</user>
<password>tecate.01</password>
</replica>
</shard>
</my_cluster>
<zookeeper>
<node>
<host>192.168.101.105</host>
<port>9181</port>
</node>
<node>
<host>192.168.101.105</host>
<port>9181</port>
</node>
</zookeeper>
<macros>
<shard>01</shard>
<replica>01</replica>
<cluster>my_cluster</cluster>
</macros>
keeper.xml
<clickhouse replace="true">
<logger>
<level>information</level>
<log>/var/log/clickhouse-keeper/clickhouse-keeper.log</log>
<errorlog>/var/log/clickhouse-keeper/clickhouse-keeper.err.log</errorlog>
<size>1000M</size>
<count>3</count>
</logger>
<listen_host>0.0.0.0</listen_host>
<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>information</raft_logs_level>
</coordination_settings>
<raft_configuration>
<server>
<id>1</id>
<hostname>192.168.101.105</hostname>
<port>8444</port>
</server>
<server>
<id>2</id>
<hostname>192.168.101.104</hostname>
<port>8444</port>
</server>
</raft_configuration>
</keeper_server>
</clickhouse>
Server 2: 192.168.101.104 docker-compose.yml
version: '3.8'
services:
clickhouse_node:
image: yandex/clickhouse-server:latest
container_name: clickhouse-node
hostname: clickhouse-node
environment:
- CLICKHOUSE_CONFIG=/etc/clickhouse-server/config.xml
- CLICKHOUSE_PASSWORD=tecate.01
volumes:
- ./clickhouse_node/config.xml:/etc/clickhouse-server/config.xml
- ./clickhouse_node/data:/var/lib/clickhouse
mem_limit: 32g
cpus: "6"
ports:
- "8123:8123"
- "9000:9000"
depends_on:
- clickhouse-keeper-node
clickhouse-keeper-node:
image: clickhouse/clickhouse-keeper:latest
container_name: clickhouse-keeper-node
hostname: clickhouse-keeper-node
volumes:
- ./clickhouse_keeper_node/clickhouse-keeper/keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml
ports:
- "9181:9181"
config.xml
<remote_servers>
<my_cluster>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>192.168.101.105</host>
<port>9000</port>
<user>default</user>
<password>tecate.01</password>
</replica>
</shard>
<shard>
<replica>
<host>192.168.101.104</host>
<port>9000</port>
<user>default</user>
<password>tecate.01</password>
</replica>
</shard>
</my_cluster>
<zookeeper>
<node>
<host>192.168.101.105</host>
<port>9181</port>
</node>
<node>
<host>192.168.101.105</host>
<port>9181</port>
</node>
</zookeeper>
<macros>
<shard>01</shard>
<replica>02</replica>
<cluster>my_cluster</cluster>
</macros>
keeper.xml
<clickhouse replace="true">
<logger>
<level>information</level>
<log>/var/log/clickhouse-keeper/clickhouse-keeper.log</log>
<errorlog>/var/log/clickhouse-keeper/clickhouse-keeper.err.log</errorlog>
<size>1000M</size>
<count>3</count>
</logger>
<listen_host>0.0.0.0</listen_host>
<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>information</raft_logs_level>
</coordination_settings>
<raft_configuration>
<server>
<id>1</id>
<hostname>192.168.101.105</hostname>
<port>8444</port>
</server>
<server>
<id>2</id>
<hostname>192.168.101.104</hostname>
<port>8444</port>
</server>
</raft_configuration>
</keeper_server>
</clickhouse>
I want the two clickhouse instances to be able to communicate with each other. Thank you very much!
Vilma Zorina Camacho Cagal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.