roachbalancer
roachbalancer is a small experimental cockroachdb load balancer with automatic live-node discovery.
The loadbalancer can be embedded or run as a stand-alone application.
Usage
Embedded
func main() {
b := balancer.New("root", "/certs", false, "xxx.xxx.xxx.xxx:26257", "xxx.xxx.xxx.xxx:26257")
go b.Listen(0) // 0 means random high port
b.WaitReady()
// now use b.GetAddr() as the cockroachdb address
}
Use the binary
./roachbalancer -certs-dir /certs -node xxx.xxx.xxx.xxx:26257