-
Notifications
You must be signed in to change notification settings - Fork 543
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
[RFC] Support multiple endpoints for load balancing and failover #894
Comments
@zhicwu it seems I need to plan thoroughly since it won't be nearly impossible to implement all of the features at once. I'll think and try to share my thought soon. BTW, what do you mean by "Parallel query"? How is it different from usual distributed table in ClickHouse? I guess it's a means to query multiple partitioned tables without resorting to the distributed table engines? Maybe first, I need to sync my understandings on your notes above with your actual intention. Thanks. |
No worries, we can start small :) Perhaps you can come up with initial pull request to get your changes merged first, and then enhance/refactor gradually in multiple releases. "Fancy" features can be considered at a later stage.
Yes, it's similar as distribute table but not limited to one cluster. It's just immature thought - I was thinking to cover multiple clusters across regions and external datasources(e.g. url() and jdbc() etc.). |
Any update @dynaxis? Just trying to avoid duplicated efforts here. I'm thinking to add an alternative of A few things to start with:
Please feel free to submit PR or review/merge changes later. |
I think this could be a reference to start with |
Thanks @arickbro. Too late that I've been implemented the better-than-nothing version :p I was expecting a better result, but too bad not much progress being made in the past week so I'm going to release the new patch anyway and hopefully gain more feedback for future enhancement. |
I can see that the load balance policy is supported at Shall I wait for a 0.3.3 release or there's some way I can depend on the patch release? |
@zhicwu Thank you! This is exactly the case. |
It's highly recommended to upgrade JDBC driver to 0.3.2 for better performance and stability. As to legacy driver, it has been removed, so hopefully it's less confusing starting 0.3.3. |
@zhicwu I made a patch to upgrade the dependency for Pulsar ClickHouse Connector apache/pulsar#18774. I'll appreciate if you can also check if the upgrade is correct and transparent to users. |
Will consider parallel read/write etc. in bridge server. |
@zhicwu cool! Do you have an estimate for 0.4.0 (the next feature release)? |
Background
ClickHouse supports clustering and often runs in a cluster. Typical approaches for load balancing and failover are:
Besides, message queues(federated or not) and customization on client-side may require to further optimize reads and writes across servers.
It would be really nice to enhance both Java client and JDBC driver to support multiple endpoints, which provides more options for people to choose. Yes, we have
BalancedClickhouseDataSource
in JDBC driver, and maybeClickHouseCluster
in Java client, but unfortunately none of them is good enough and the latter was not even tested on a clustered environment.Concept
Endpoint - essentially a combination of host, port and protocol. It may contain additional information like status, role, tags, weight, server revision/version/timezone, and credentials for authentication.
(localhost, 8123, http)
and(127.0.0.1, 8123, http)
are different endpoints.Server - an instance of ClickHouse server, which exposes multiple endpoints for client to connect to.
clickhouse-local
is a special type of server, which only exists when needed.Cluster - a group of ClickHouse servers under same name, as described in
system.clusters
table.User Scenario
X-ClickHouse-Server
in responseX-ClickHouse-Server
in responseX-ClickHouse-Server
in responseProposed Solution
In order to support above user scenarios, we need to implement below features:
X-ClickHouse-Server
in response)Potential changes to existing code:
ClickHouseNode
.ClickHouseEndpoint
andClickHouseCluster
, and a background thread for health check.ClickHouseEndpoints
for picking an endpoint from a sorted(based on status, weight and maybe distance) and filtered(based on tags etc.) listjdbc:ch://server1,(grpc://server2?tags=dc2),(tcp://server3:9000),(http://user4:passwd@server4:8124/db4?tags=dc1)/db?cluster=mycluster&tags=dc1&lbPolicy=firstAlive&autoDiscovery=true
firstAlive
(default) orroundRobin
true
orfalse
(default), only retry on network issue or failure of select querytrue
orfalse
(default)true
(default) orfalse
The text was updated successfully, but these errors were encountered: