SUSE 12 environment installation keepalived and problems encountered (0penStack platform virtual machine)

SUSE 12 environment installation keepalived and encountered problems (0penStack platform virtual machine)

1, project requirements need to do mysql high Available clusters, the final choice of mysql+keepalived way, this document only describes the keepalived installation and problems encountered.

2, ready to install the package in advance: keepalived-2.0.7.tar.gz To install keepalived, you must first install the dependencies zypper install -y libnfnetlink-devel zlib zlib-devel gcc gcc-c++ openssl openssl-devel openssh Zypper install -y libnl* ipvsadm (These two packages must be installed, because keepalived is highly available based on ipvsadm) After the installation is complete, check if the ip_vs module is started. lsmod |grep ip_vs输出上图结果正常,如无需收到加载

3, unzip keepalived-2.0.7.tar.gz Tar -zxvf keepalived-2.0.7.tar.gz Cd keepalived-2.0.7 Execute ./configure --prefix=/usr/local/keepalived (specify the installation directory - custom) && make && make install Execute the completion check to report any errors. Enter the installation directory Modify the configuration file

4, start keepalived (this is the double live, the other one will do it again as above) Check the log process to check whether keepalived starts normally

5. The maximum pit encountered in this installation Two keepalived cannot be automatically switched. The reason is that the virtual machine mac address under OpenStack cannot be unbind automatically. When a keepalived machine is down, the virtual IP is still bound to the current virtual machine network card. Due to environmental limitations, my temporary solution here is to "ping the LAN gateway or other connectable server IP address -I keepalived virtual IP -c 3" after another keepalived monitors another heartbeat. (This means that the virtual IP short pings the gateway or the machine in the LAN three times. When the virtual platform detects that the address is invalid, it is unbound), so that another bindable virtual IP can achieve the purpose of switching. Note: This method will lose 1 when switching. ~2 packages 当keepalived宕机后此虚拟IP应当自动解绑另一台才能切换为主机绑定IP ,不然IP占用另外一台无法工作

下图 is my keepalived configuration

! Configuration File for keepalived

Global_defs {
   Notification_email {
     [email protected]
     [email protected]
     [email protected]
   Notification_email_from [email protected]
   Smtp_connect_timeout 30
   Router_id joychat
# vrrp_strict
# vrrp_garp_interval 0
# vrrp_gna_interval 0

Vrrp_instance VI_1 {
    State BACKUP
    Interface eth0
    Virtual_router_id 54
    Priority 100
    Advert_int 1
# nopreempt
    Authentication {
        Auth_type PASS
        Auth_pass 1111
    Virtual_ipaddress {
        Notify_master "/data/keepalived/"

Virtual_server virtual-IP 3306 {
    Delay_loop 2
# lb_algo rr
# lb_kind NAT
    Persistence_timeout 60
    Protocol TCP

    Real_server mysq-IP 3306 {
        Weight 1
        Notify_down /data/keepalived/
        TCP_CHECK {
                Connect_timeout 10
                Nb_get_retry 3
                Delay_before_retry 3
                Connect_prot 3306


I am limited in level, I hope other friends with better methods to leave a message!