Search code examples
clickhouse

DB::Exception: default: Authentication failed [ClickHouse]


I Create CH with 1 shard and create some db and tables then i change my cluster to have 2 shard. shard 2 started and have all of tables but when i use this query i get error:

SELECT hostname() FROM tutorial.visits_all

Received exception from server (version 21.3.20): Code: 516. DB::Exception: Received from localhost:9000. DB::Exception: Received from chi-repl-05-replicated-0-0:9000. DB::Exception: default: Authentication failed: password is incorrect or there is no user with such name.

I'm sure my password is correct and i use this command clickhouse-client -h clickhouse-repl-05.rezvani-prom.svc --password qwerty --query "select hostname() from tutorial.visits_all"

Can anyone help me please

Thank you


Solution

  • Distributed queries use default user to connect to other shards. There are options

    1. remove password from default user and setup < network > restriction for default user.
    2. setup password for default user and use the same password in remote_servers
    3. setup < secret > for remote_servers
    4. setup another user and use this user in remote_servers
    5. host_regexp in case of operator

    https://github.com/Altinity/clickhouse-operator/issues?q=is%3Aissue+is%3Aopen+host_regexp