Skip to content

Add separate TCP dial address for ClickHouse connections - #160

Merged
BorisTyshkevich merged 2 commits into
mainfrom
codex/issue-159-connect-host
Aug 5, 2026
Merged

Add separate TCP dial address for ClickHouse connections#160
BorisTyshkevich merged 2 commits into
mainfrom
codex/issue-159-connect-host

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

Summary

  • add optional clickhouse.connect_host configuration through YAML, JSON, CLI, and CLICKHOUSE_CONNECT_HOST
  • keep clickhouse.host as the logical HTTP and TLS identity while overriding only the underlying TCP destination
  • support HTTP and native TCP with and without TLS, IPv4/IPv6 address formatting, and static multicluster dial destinations
  • validate malformed dial hosts during startup, reload, and direct client creation
  • document the setting in the main README and Helm examples

Why

Some deployments must bypass DNS or connect through a fixed internal address without changing the logical ClickHouse hostname. Using the IP as clickhouse.host breaks HTTP routing, TLS SNI, and certificate hostname verification. This change separates those concerns while preserving existing behavior when the override is unset.

Closes #159.

Validation

  • go test -short ./...
  • go test -race ./pkg/config ./pkg/clickhouse ./pkg/server -short
  • go test ./pkg/clickhouse -run '^TestConnectHostPlainProtocols$' -count=1 -v
  • git diff --check

The integration test connects successfully to real embedded ClickHouse listeners over both HTTP and native TCP using an intentionally non-resolvable logical hostname and a reachable connect_host.

@BorisTyshkevich
BorisTyshkevich marked this pull request as ready for review August 5, 2026 10:31
@BorisTyshkevich
BorisTyshkevich merged commit e313d3c into main Aug 5, 2026
4 checks passed
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.

Allow a separate TCP dial address for ClickHouse connections

1 participant