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

Support connecting to the database by DNS SRV records #1196

Open
namco1992 opened this issue Feb 21, 2024 · 0 comments
Open

Support connecting to the database by DNS SRV records #1196

namco1992 opened this issue Feb 21, 2024 · 0 comments

Comments

@namco1992
Copy link

Is your feature request related to a problem? Please describe.
Connecting to the DB with DNS SRV records is a fairly common approach when you need some load balancing. E.g. MySQL and MongoDB support it. It would be great that the clickhouse-go can support connecting to the server by DNS SRV records.

Describe the solution you'd like
The clickhouse-go can support connecting to the server by DNS SRV records.

It can be set in the DSN with a unique protocol clickhouse+srv://:

clickhouse+srv://username:password@_ch._tcp.example.com/database?xxx

Or controlled by a flag in Options:

type Options struct {
    // Other options
    ResolveSRV bool  // Resolve the DNS SRV records and populate the list of hosts to connect to
}

Describe alternatives you've considered
It is possible to resolve the DNS SRV records outside the driver, and provide the resolved host list to the driver when opening a conn. However, the SRV records need to be continuously resolved as the host list could change. One alternative is that we resolve the DNS and create a new conn every time we interact with the DB, but it feels wasteful and slow.

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants