CentOS / Redhat Linux: Install Keepalived To Provide IP Failover For Web Cluster

CentOS / Redhat Linux: Install Keepalived To Provide IP Failover For Web Cluster

Keepalived is a Linux utility that can be used to provide IP failover for a web cluster. To install Keepalived on a CentOS or Red Hat Linux system, you can use the following steps:

  1. Install the keepalived package: Use the package manager to install the keepalived package. On CentOS or Red Hat systems, you can use yum to install the package:
refer‮ ‬to:lautturi.com
sudo yum install keepalived
  1. Configure Keepalived: Create a configuration file for Keepalived in the /etc/keepalived directory. The configuration file should specify the virtual IP address that will be used for the web cluster, as well as the network interfaces and IP addresses of the cluster nodes.

Here is an example configuration file that configures Keepalived to provide IP failover for a web cluster with two nodes:

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass password
    }
    virtual_ipaddress {
        10.0.0.100
    }
}

virtual_server 10.0.0.100 80 {
    delay_loop 6
    lb_algo wrr
    lb_kind DR
    protocol TCP

    real_server 10.0.0.101 80 {
    }
Created Time:2017-10-27 14:56:37  Author:lautturi