This is for a 2 box load balancer:
keepalived:
download install keepalived:
wget http://www.keepalived.org/software/keepalived-1.1.15.tar.gz
tar -zxvf keepalived-1.1.15.tar.gz && cd keepalived-1.1.15.tar.gz && ./configure --prefix=/usr --sysconfdir=/etc && make && sudo make install
sudo vi /etc/sysctl.conf
net.ipv4.ip_nonlocal_bind=1 <--- have to do this to enable it to bind to a non local ip
sudo sysctl -p
lb1:
vi /etc/keepalived/keepalived.conf
vrrp_script chk_haproxy { # Requires keepalived-1.1.13
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 101 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.0.99
}
track_script {
chk_haproxy
}
}
lb2:
vi /etc/keepalived/keepalived.conf
vrrp_script chk_haproxy { # Requires keepalived-1.1.13
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 100 # 101 on master, 100 on backup
virtual_ipaddress {
192.168.0.99
}
track_script {
chk_haproxy
}
}
I found some of the configs off a HOWTO forge and tweaked a little to suit my configurations, thank you to whomever.
No comments:
Post a Comment