How to Use KeepAlived in Centos 7

 




Install KeepAlived



Set Linux Kernel parameters as follows to support Floating IP




Configure keepalived setting



Add and configure the script like this (For Master)

! Configuration File for keepalived

global_defs {
   notification_email {
  root@webserver-01.centlinux.com
   }
   notification_email_from root@webserver-01.centlinux.com
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state MASTER
    interface enp0s3
    virtual_router_id 51
    priority 101 #used in election, 101 for master & 100 or less for backup
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.16.132/24
    }
}


Add and configure the script like this (For Backup)


! Configuration File for keepalived

global_defs {
   notification_email {
  root@webserver-02.centlinux.com
   }
   notification_email_from root@webserver-02.centlinux.com
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP
    interface enp0s3
    virtual_router_id 51
    priority 100 #used in election, 101 for master & 100 or less for backup
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.16.132/24
    }
}



PHOTOS:







Komentar

Postingan Populer