Keepalived for high-availability cluster software in Linux
Keepalived cluster software is a LVS (layer-4 protocol) service high availability solution based on VRRP protocol, which can be used to avoid Single Node faults. the LVS service requires two servers to run the Keepalived service. One is the MASTER server (MASTER) and the other is the BACKUP server (BACKUP), but there is only one external virtual IP address, the master server sends a specific message to the backup server. When the backup server fails to receive the message, the backup server determines that the master server is down and takes over the virtual IP address to provide services, this ensures high service availability.
Haproxy + Keepalived + Apache configuration notes in CentOS 6.3
Haproxy + KeepAlived WEB Cluster on CentOS 6
Keepalived + Haproxy configure high-availability Load Balancing
Haproxy + Keepalived build high-availability Load Balancing
Configure LVS + Keepalived + ipvsadm on CentOS 7
Keepalived high-availability cluster Construction
1. Environment Description
System: CentOS 6.5 64-bit
Software: Keepalived ipvsadm
Service: apache
Network:
Node1: 192.168.1.100
Node2: 192.168.1.102
Vip: 192.168.1.105
2. Configure local time and network
(1) the time between the two servers must be 1
[Root @ node2 ~] # Date -- the time of Node 2
Thu Nov 13 15:11:09 CST 2014
[Root @ node2 ~] #
[Root @ node1 ~] # Date -- time of Node 1
Thu Nov 13 15:11:13 CST 2014
[Root @ node1 ~] #
(2) configure the local network
Node1 node:
[Root @ node1 ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
HWADDR = 08: 00: 27: EE: 3D: F6
TYPE = Ethernet
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.1.100
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.1
[Root @ node1 ~] # Vim/etc/hosts-Mutual parsing between the two servers
192.168.1.100 node1
192.168.1.102 node2
[Root @ node1 ~] #
Node2 node:
[Root @ node2 ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
HWADDR = 08: 00: 27: A5: 94: 4C
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.1.102
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.1
[Root @ node2 ~] # Vim/etc/hosts
192.168.1.100 node1
192.168.1.102 node2
[Root @ node2 ~] #
3. Install the required software package and configure the httpd service.
Node1 node:
[Root @ node1 ~] # Yum install httpd keepalived ipvsadm-y -- install the required software
[Root @ node1 ~] # Vim/etc/httpd/conf/httpd. conf
ServerName 127.0.0.1
[Root @ node1 ~] # Echo "node1">/var/www/html/index.html -- Define the web Homepage
[Root @ node1 ~] #/Etc/init. d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: [OK]
[Root @ node1 ~] # Chkconfig httpd on -- restart the web Service
[Root @ node1 ~] #
Node2 node:
[Root @ node2 ~] # Yum install httpd keepalived ipvsadm-y
[Root @ node2 ~] # Vim/etc/httpd/conf/httpd. conf
ServerName 127.0.0.1
[Root @ node2 ~] # Echo "node2">/var/www/html/index.html
[Root @ node2 ~] #/Etc/init. d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: [OK]
[Root @ node2 ~] # Chkconfig httpd on
For more details, please continue to read the highlights on the next page: