Multiple host connection string

Hi Cockroach,

Does Cockroach support multiple host connection string? Something like…

postgresql://root@192.168.1.1,192.168.1.2,192.168.1.3/bank?sslmode=disable

or we have to create a load-balance in front of cockroach cluster?

Thank you

You can use haporxy,
refer to https://www.cockroachlabs.com/docs/stable/generate-cockroachdb-resources.html

@jawc The connection string is interpreted by the client library, not the Cockroach server. I’m not aware of which client libraries support multiple hosts in the connection string like that. If you’re using Go, I hacked up a small SQL driver that wraps around lib/pq and allows you to specify multiple URLs to round-robin amongst: https://github.com/cockroachdb/loadgen/blob/master/internal/driver/driver.go.

Or, as @Jasonsays, you can use a load-balancer like haproxy.