Skip to content

Client fault tolerant connection by multiple hosts #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1,424 commits into
base: updated-master
Choose a base branch
from

Conversation

df530
Copy link
Collaborator

@df530 df530 commented Jan 19, 2022

Changelog category (leave one):

New Feature
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Parameter --host can accept multiple hosts. In case of unavailability of one of them, the client will try to connect to the next one.

Detailed description / Documentation draft:
Feature accept setting multiple hosts for connection. It approves fault tolerance of connection because when one host isn't alive client can try to connect to another one.

Parameter --host can accept multiple addresses. Every address must contain resolvable host and can also contain portif it isn't set, port from --port is used). Example of usage:
clickhouse-client --host host1:1 host2 host3:3 --port 2 --query "SELECT 1"

When multiple addresses are passed to the host argument and the first one is unavailable, the client will try to connect to the next one (round robin approach). In the example, if client can't connect to host1:1, it will try to connect to host2 and port 2, which is set in --port.

By adding documentation, you'll allow users to try your new feature immediately, not when someone else will have time to document it later. Documentation is necessary for all features that affect user experience in any way. You can add brief documentation draft above, or add documentation right into your patch as Markdown files in docs folder.

If you are doing this for the first time, it's recommended to read the lightweight Contributing to ClickHouse Documentation guide first.

Information about CI checks: https://clickhouse.tech/docs/en/development/continuous-integration/

@df530 df530 changed the title Client fault tolerant connection Test PR Jan 19, 2022
@df530 df530 force-pushed the client-fault-tolerant-connection branch 2 times, most recently from a3e748c to 94e48b0 Compare January 19, 2022 22:33
@df530 df530 changed the title Test PR Client fault tolerant connection by multiple hosts Jan 19, 2022
Copy link
Member

@PolyProgrammist PolyProgrammist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add description

if (options.count("host"))
{
hosts_ports = options["host"].as<std::vector<HostPort>>();
config().setString("host", hosts_ports[0].host);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You set it here, but anyway you do it later in a round robin loop. Do you really need it here?

Copy link
Collaborator Author

@df530 df530 Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to set "host" before round-robin, because I need to create ConnectionParameters(config()) in connect method. I thought, that it would be better to set config() before calling connect.

@df530 df530 force-pushed the client-fault-tolerant-connection branch from 94e48b0 to 962d851 Compare January 20, 2022 09:54
andycol and others added 24 commits February 2, 2022 14:32
fix the run command and add example
Before this patch current_user/current_address will be preserved from
the previous query.

Signed-off-by: Azat Khuzhin <[email protected]>
Update list-versions.sh, update version_date.tsv
…-for-show-grants

Fix checking grants for SHOW GRANTS
…ssword

Add 'clickhouse-client --password' comment to the scripts used in Qui…
Disable data skipping indexes by default for queries with FINAL
Support async inserts in clickhouse-client for queries with inlined data
@df530 df530 force-pushed the client-fault-tolerant-connection branch from 3253ae1 to c1df291 Compare February 7, 2022 23:04
alexey-milovidov and others added 26 commits February 8, 2022 02:27
…rays

Fix consecutive backward seeks in seekable read buffers
…database-memory

Fix wrong engine in SHOW CREATE DATABASE with engine Memory ClickHouse#34225
Add table function format(format_name, data)
Add composability to casting and index operators
…temp-tables-via-grpc

Fix inserting to temporary tables via gRPC.
…metadata

Better local metadata comparison with ZooKeeper metadata
Fix segfault in schema inference from url
Fix various issues when projection is enabled by default
Revert "Merge pull request ClickHouse#34373 from ClickHouse/docker-tz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.