If my understanding of the clickhouse-go is incorrect, please let me know.
clickhouse-go supports providing multiple hosts for load-balancing/failover via Options.Addr or the DSN hosts parameter. However, this requires a static list of endpoints.
In Kubernetes (and other dynamic environments), we commonly connect via:
- DNS name (single hostname, multiple A/AAAA records)
In these setups, the set of IPs behind a hostname can change over time (rolling updates, pod churn, scale up/down). Today, users must implement DNS resolution outside the driver and rebuild connections manually, which is operationally fragile and duplicates logic across services.
I need
- Resolve a hostname to all A/AAAA addresses and treat them as the host pool (similar to how the DSN hosts list is used).
- Re-resolve periodically (or on reconnect) so the pool updates when DNS changes.
Example
clickhouse://my-clickhouse-01.dns:9000/db?resolve_dns=1&resolve_dns_interval=30s