Skip to content
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

Question about BalancedClickhouseDataSource #949

Closed
zcw5116 opened this issue Jun 9, 2022 · 1 comment · Fixed by #956
Closed

Question about BalancedClickhouseDataSource #949

zcw5116 opened this issue Jun 9, 2022 · 1 comment · Fixed by #956
Labels

Comments

@zcw5116
Copy link

zcw5116 commented Jun 9, 2022

Old Driver [ru.yandex.clickhouse] has class BalancedClickhouseDataSource, which can be used for assigning multiple hosts,
New Driver [com.clickhouse.jdbc.ClickHouseDriver], if plan to support BalancedClickhouseDataSource?

@zhicwu
Copy link
Contributor

zhicwu commented Jun 9, 2022

Hi @zcw5116, sorry the feature is still under testing. It will be part of 0.3.2-patch10 which hopefully can be released by this weekend.

Basically, there's no BalancedClickhouseDataSource. You just need to specify multiple endpoints in connection string. For examples:

  1. load balancing among 3 endpoints
    jdbc:ch://(http://localhost),(grpc://localhost),(tcp://localhost)/mydb?load_balancing_policy=random&health_check_interval=10000
  2. load balancing for specific cluster with node discovery
    jdbc:ch:http://node1,(grpc://node2?auto_discovery),{node3?!auto_discovery}/mydb?cluster=cluster1&load_balancing_policy=roundRobin&health_check_interval=5000&discovery_interval=30000
  3. custom load balancing policy
    jdbc:ch:http://node1,node2,node3/test?load_balancing_policy=com.my company.integration.clickhouse.DcAwarePolicy&health_check_interval=5000

I noticed quite some connection refused errors during stress testing against master nodes(the ones running clickhouse-keeper), so I'm going to add naive failover tonight to address that.

@zhicwu zhicwu added the question label Jun 9, 2022
@zhicwu zhicwu linked a pull request Jun 19, 2022 that will close this issue
@zhicwu zhicwu closed this as completed Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants