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:
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:sudo yum install keepalived
/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 {
}