keepalived telepítése
- /etc/sysctl.conf-ba:
.. TODO: Indent lines, set language: Example .. code-block:: python net.ipv4.ip_nonlocal_bind=1
sysctl -w net.ipv4.ip_nonlocal_bind=1
apt-get install keepalived
/etc/keepalived/keepalived.conf-ba:
.. TODO: Indent lines, set language: Example .. code-block:: python
Settings for notifications
global_defs {
notification_email {
your@emailaddress.com # Email address for notifications
}
notification_email_from loadb01@domain.ext # The from address for the notifications
smtp_server 127.0.0.1 # You can specifiy your own smtp server here
smtp_connect_timeout 15
}
Define the script used to check if haproxy is still working
#vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
weight 2
#}
Configuation for the virtual interface
vrrp_instance VI_1 { interface eth0 state MASTER # set this to BACKUP on the other machine priority 101 # set this to 100 on the other machine virtual_router_id 51
smtp_alert # Activate email notifications
authentication {
auth_type AH
auth_pass myPassw0rd # Set this to some secret phrase
}
# The virtual ip address shared between the two loadbalancers
virtual_ipaddress {
192.168.0.200
}
# Use the script above to check if we should fail over
track_script {
chk_haproxy
}
}
- másodlagos szerveren ugyanez, az alábbi módosításokkal
.. TODO: Indent lines, set language: Example .. code-block:: python state BACKUP priority 100
/etc/init.d/keepalived start