I am trying to load balance with haproxy on VirtualBox just to see that things work as they should before I go on to set it up on Digital Ocean. I am able to decide how to balance requests when I choose mode http, but when I choose mode tcp, all requests from the same machine/client goes to the same server, and does not alternate. I would like it to alternate with either roundrobin or leastconn. I would like to set up the simplest configuration file that is possible to achieve this. This is what I have so far. But it is not working as I described.
global chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4096 user haproxy group haproxy daemon defaults mode tcp frontend main *:80 default_backend nodes backend nodes balance roundrobin server goapp1 192.168.1.101:80 check server goapp2 192.168.1.102:80 check
How can I achieve this?