简体   繁体   中英

Not able to connect to zookeeper from clickhouse

I am using Bitnami Zookeeper AMI for AWS and have configured a 3 node cluster. I have specified them in my clickhouse configuration file as following.

<zookeeper>
        <node index="1">
                 <host>X.X.X.X</host>
                <port>2181</port>
        </node>
        <node index="2">
                <host>X.X.X.X</host>
                <port>2181</port>
        </node>
        <node index="3">
                <host>X.X.X.X</host>
                <port>2181</port>
        </node>
</zookeeper>
<macros>
        <shard>01</shard>
        <replica>ec2-X-X-X-X.compute-1.amazonaws.com</replica>
</macros>

Now when I am trying to create a ReplicatedMergeTree table using the following query on one of my clickhouse node

CREATE TABLE ontime_replica (Year UInt16,
Month UInt8,
DayofMonth UInt8,
FlightDate Date
)
ENGINE = ReplicatedMergeTree(
'/clickhouse/tables/{shard}/ontime',
'{replica}',
FlightDate,
(Year, FlightDate),
8192);

I get the following exception

Query execution failed

Reason:
SQL Error [999]: ClickHouse exception, code: 999, host: <Clickhouse node IP>, port: 
8123; Code: 999, e.displayText() = Coordination::Exception: Not 
authenticated, path: /clickhouse, e.what() = Coordination::Exception

In my zookeeper logs I get the following message

2019-01-29 09:44:44,991 [myid:2] - INFO  [ProcessThread(sid:2 
cport:-1)::PrepRequestProcessor@653] - Got user-level KeeperException when 
processing sessionid:0x1000437dc070000 type:create cxid:0x18 
zxid:0x700000009 txntype:-1 reqpath:n/a Error Path:null 
Error:KeeperErrorCode = NoAuth

Added

skipACL=yes

in my zookeeper config to skip authentication.

To connect to zookeeper with login and password you should configure ClickHouse like that:

<yandex>
    <zookeeper>
        <node index="1">
            <host>X.X.X.X</host>
            <port>2181</port>
        </node>
        <node index="2">
            <host>Y.Y.Y.Y</host>
            <port>2181</port>
        </node>
        <node index="3">
            <host>Z.Z.Z.Z</host>
            <port>2181</port>
        </node>
        <identity>user:password</identity>
    </zookeeper>
</yandex>

After changing the configuration you will need to restart ClickHouse server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM