Home > OS >  Clickhouse server can't connect to Zookeeper
Clickhouse server can't connect to Zookeeper

Time:05-26

I am running Clickhouse server on a Azure VM and trying to create a table using ReplicatedMergeTree engine (following this guide: https://medium.com/@merticariug/distributed-clickhouse-configuration-d412c211687c). I have zookeeper running on another Azure VM in the same subnet.

CREATE TABLE shard.test
(
   id Int64,
   event_time DateTime
)
Engine=ReplicatedMergeTree('/clickhouse/tables/shard1/test', 'replica_1')
PARTITION BY toYYYYMMDD(event_time)
ORDER BY id;

When I run the above command to create a replicated table, I get this error on my clickhouse-client:

Code: 225. DB::Exception: Received from localhost:9000. DB::Exception: Can't create replicated table without ZooKeeper. (NO_ZOOKEEPER)

I have uncommented the zoopkeeper portion of /etc/clickhouse-server/config.xml and also added a separate xml file for zookeeper in /etc/clickhouse-server/config.d/

Here is the content of /etc/clickhouse-server/config.d/zookeeper.xml:

<clickhouse>
    <zookeeper>
        <node>
            <host>public_IP</host>
            <port>2181</port>
        </node>
    </zookeeper>
</clickhouse>

Am I missing some config changes?

CodePudding user response:

probably the problem is network restrictions, firewall, ...

this should work from CH server

 echo stat | nc public_IP 2181

CodePudding user response:

In zookeeper.xml, replace <clickhouse> and </clickhouse> with <yandex> and </yandex> respectively. Then restart the clickhouse-server using sudo service clickhouse-server restart.

  • Related