Mysql Load Balancer Reccomendation

Discussion in 'HOWTO-Related Questions' started by tfunky, Mar 16, 2008.

  1. tfunky

    tfunky New Member

    Hi All,

    I just built and tested the master-master mysql5 pair on Etch (whoohoo) !

    I was going to put a load balancer pair in front of them so I could use a VIP, etc.

    I went to follow the directions for ultra monkey on debian like I did in the past, but it's for sarge. After snooping around the ultramonkey website I don't see a etch version.

    All that being said...

    What's the easiest way to do the equivalent with etch?

    Or is there a better way to go about doing this? (ie just install haproxy or ldirector, or heartbeat, etc)

    I'm love to hear your recommendations!

    Thanks!

    Tfunk
     
  2. falko

    falko Super Moderator Howtoforge Staff

    You can use haproxy and heartbeat (or keepalived) for this. :)
     
  3. tfunky

    tfunky New Member

    Hey Falko!

    I took your advice and setup a HAProxy/heartbeat pair.

    It took some considerable reading to pull it off as it's not really made for that and most people use it for web proxying.

    That being said, I thought I'd paste the revelent part of the config here to save others some time if they attempt it :) This may not be the best way, but it is working. ;)

    Code:
    listen db_proxy 192.168.1.190:3306
            mode tcp
           stats enable
           stats auth someuser:somepassword
           balance roundrobin
         #  cookie JSESSIONID prefix
         #  option httpclose
         #  option forwardfor
         #  option httpchk HEAD /check.txt HTTP/1.0
           server c1 192.168.1.191
           server c2 192.168.1.192
    
    I can't seem to get the stats to work though. I'm not sure what I have messed up. I thought stats enabled and the password was all that was needed, but apparently I'm missing something.

    Hopefully that helps someone!

    Thanks for your help Falko!
     
  4. falko

    falko Super Moderator Howtoforge Staff

    I think the problem is that you've enabled the stats for a MySQL connection, not a web connection, but that's just a guess. I haven't tried this myself...
     
  5. tfunky

    tfunky New Member

    I've played with the stats thing some more and I've got it working...I don't know if this is the best way...but at least it's working....

    I added a "new" proxy

    Code:
        # catches any URI and returns the status page.
    listen stats :8080
            mode http
            balance roundrobin
            stats uri /
    
    and moved the stats enable to the defaults section.

    With that stanza you can access the http://<your virtual ip>:8080 and see the stats.

    Thanks for getting me to look in the right place :D
     

Share This Page