HAProxy roundrobin weights

haproxyload balancing

I'm attempting to modify my current haproxy configuration to favor 1 server over the others (70%,15,15) Does anyone know if this is possible? Reading the docs I see a "weight" option, but I'm a bit weary of messing around with production servers.

Here's my current config:

listen MySQL 10.10.10.14:3306
   mode tcp
   balance roundrobin
   option persist
   server sql1 10.10.10.4:3306
   server sql2 10.10.10.5:3306
   server sql3 10.10.10.6:3306

Best Answer

There is a weight operator for the server line.
This works withing a range 0-256 where, 0 bypasses a server from the loop.
You should lookup these in the HAproxy Configuration.txt.

For a 75-15-15 distribution the weights should probably be 22-10-10.

I would expect the server lines to look like these, but please recheck with the notes or some better references.

   server sql1 10.10.10.4:3306 weight 22
   server sql2 10.10.10.5:3306 weight 10
   server sql3 10.10.10.6:3306 weight 10