Reply to LVS + heartbeat installation and deployment document
Required software:
Ipvsadm-1.24-10.x86_64.rpm
Heartbeat-2.1.3-3.el5.centos.x86_64.rpm
Heartbeat-pils-2.1.3-3.el5.centos.x86_64.rpm
Heartbeat-stonith-2.1.3-3.el5.centos.x86_64.rpm
PyXML-0.8.4-4.x86_64.rpm
System Environment:
Centos 5.4 64-bit
HA1 10.0.0.108
HA1 10.0.0.109
Web1 10.0.0.110
Web2 10.0.0.111
VIP 10.0.0.100
Installation of ipvsadm-1.24
Rpm-IVH ipvsadm-1.24-10.x86_64.rpm
/Sbin/ipvsadm
Install heartbeat
Rpm-IVH heartbeat-pils-2.1.3-3.el5.centos.x86_64.rpm
Rpm-IVH heartbeat-stonith-2.1.3-3.el5.centos.x86_64.rpm
Rpm-IVH PyXML-0.8.4-4.x86_64.rpm
Rpm-IVH heartbeat-2.1.3-3.el5.centos.x86_64.rpm
NOTE: If heartbeat is not installed once, install it again.
Rpm-Q heartbeat-D // view the installation path
Echo "service heartbeat start" & gt;/etc/rc. Local
Configure heartbeat
CD/usr/share/doc/heartbeat-2.1.3/
CP authkeys ha. Cf haresources/etc/ha. d/
CD/etc/ha. DVI authkeys
# Setting the verification mode without comments
Auth 1
1 CRC
#2 sha1 hi!
#3 MD5 hello! Echo "10.0.0.108 HA1" & gt;/etc/hosts
Echo "10.0.0.109 ha2" & gt;/etc/hostsvi haresources
# Add: (about 44 rows)
HA1 10.0.0.100 VIP. shvi ha. cf
# Remove comments (about 95 rows)
Bcast eth0
# Remove comments and modify (about 125 rows)
Ucast eth0 10.0.0.109
# Remove comments and modify (about 215 and 216 rows)
Node HA1
Node ha2chmod 600 authkeysvi/etc/init. d/VIP. Sh #/sbin/bash!
Ifconfig eth0: 0 10.0.0.100 broadcast 10.0.0.100 netmask 255.255.255.255 up
Route add-host 10.0.0.100 Dev eth0: 0
# Setup s
Ipvsadm-C
Ipvsadm-a-t 10.0.0.100: 80-s rr
Ipvsadm-a-t 10.0.0.100: 80-r 10.0.0.110-G
Ipvsadm-a-t 10.0.0.100: 80-r 10.0.0.111-G
Ipvsadm
The configuration of ha2 is the same as that of HA1. You can directly upload the authkeys ha. Cf haresources files of HA1.
SFTP 10.0.0.108
CD/etc/ha. d
Get authkeys ha. Cf haresources
Quit
In ha2, modify ha. CF (about 125 rows):
Ucast eth0 10.0.0.108
Place VIP. Sh on The LVS Server
VI/etc/init. d/VIP. Sh // put it here for auto start
Chmod 755/etc/init. d/VIP. Sh
/Etc/init. d/VIP. Sh
Echo "service heartbeat start" & gt;/etc/rc. Local
LVS. Sh
#/Sbin/bash!
Ifconfig lo: 0 10.0.0.100 broadcast 10.0.0.100 netmask 255.255.255.255 up
Route add-host 10.0.0.100 Dev lo: 0
Echo "1" & gt;/proc/sys/NET/IPv4/CONF/LO/arp_ignore
Echo "2" & gt;/proc/sys/NET/IPv4/CONF/LO/arp_announce
Echo "1" & gt;/proc/sys/NET/IPv4/CONF/All/arp_ignore
Echo "2" & gt;/proc/sys/NET/IPv4/CONF/All/arp_announce
Sysctl-P
Web1 web2 Install Web Services
Installation Process
Note:
Put LVS. Sh on the Web Server
# Vi/etc/init. d/LVS. Sh // put it here for auto start
# Chmod 755/etc/init. d/LVS. Sh
#/Etc/init. d/LVS. Sh
Conclusion:
Constantly refresh 10.0.0.100 to display the web1 and web2 pages in turn
LVS + heartbeat installation and deployment documentation