4

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

5
  • 1
    this message is from the Distributed table. It cannot connect to another server. Shards use default user by default to connect to each other. You can configure secret in remote_servers or another user/password pair. Commented Apr 5, 2022 at 12:11
  • @DennyCrane I think this is from set password for default user. I say that because when i remove password my query works. Commented Apr 6, 2022 at 10:19
  • 1
    yes. It's expected. Use host_regex and remove password github.com/Altinity/clickhouse-operator/… Commented Apr 6, 2022 at 12:26
  • @DennyCrane What is the best way in k8s? Commented Apr 9, 2022 at 6:08
  • 1
    host_regexp in case of operator Commented Apr 9, 2022 at 13:39

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.