Load Balancer with HAProxy

Hi there,

I was following this tutorial for setting up HAProxy Load Balancer, but i am unable to access my cluster through the load balancer. I’ve created everything on my local machine. The cluster works fine. I’ve generated the haproxy.cfg file successfully and run HAProxy as stipulated by the docs.

When i try to load the initial ycsb schema and data, pointing it at HAProxy’s port as follows cockroach workload init ycsb 'postgresql://root@localhost:26000?sslmode=disable', i get the error Error: dial tcp [::1]:26000: connect: connection refused

If i load the initial ycsb schema and data to one of the nodes, it works perfectly. Where could i be messing up with load balancer?

I am on a debian distro.

Hey @kingmoses,

Can you send over your haproxy.cfg file? Make sure that it looks like:

listen psql
    bind :26000
    mode tcp

The default bind value is 26257, you need to manually edit it before starting haproxy. A lot of people miss that step.

Hi @tim-o. I managed to sort that out. My fix was, instead of using bind :26000 , i used the full url localhost:26000 which worked just fine. Maybe there is a configuration i am supposed to do on the HAProxy.

Anyway thanks so much for your willingness to help. I appreciate.

CockroachDB is the best