Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
add comment

1 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
share|improve this answer
    
I want to learn how do you calculate these weights: > For a 75-15-15 distribution the weights should probably be 22-10-10 Thanks in advance. –  user138619 Sep 26 '12 at 22:48
1  
Where did those weights come from?? Haproxy should use the weight in linear propotion to the total weight. So 22-10-10 = 52% 24% 24%. That's not 70-15-15, which are the numbers he should actually use if he wants that distribution. –  Chris S Sep 27 '12 at 1:45
    
cbonte.github.com/haproxy-dconv/configuration-1.4.html#5-weight is an easier link for the documentation. –  Xiong Chiamiov Oct 22 '12 at 21:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.