HA high-availability cluster and HA Available Cluster
Prepare two machines:
Master: 192.168.254.140
Slave: 192.168.254.141vim/etc/hosts master, slave: 192.168.254.140 master192.168.254.141 slave
1. Master and master installation:
Wget www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm
Rpm-ivh epel-release-6-8_64.noarch.rpm
Yum install-y libnetyum install-y heartbeat
2. Edit the three configuration files of HA on the master.
Cd/usr/share/doc/heartbeat-3.0.4/
Cp authkeys ha. cf haresources/etc/ha. d/
Cd/etc/ha. d/
Vim authkeys
Chmod 600 authkeys
Vim haresources the ip address here is vip:
The following configuration file is different between the master and slave nodes:
Vim ha. cf
Debugfile/var/log/ha-debug
Logfile/var/log/ha-log
Logfacility local0
Keepalive 2
Deadtime 30
Warntime 10
Initdead 60
Udpport 649
Ucast eth0 192.168.254.141 # Here, the ip address is the ip address of the other Party. If it is from 140
Auto_failback on
Node master
Node slave
Ping 192.168.1.1
Respawn hacluster/usr/lib64/heartbeat/ipfail
3. Copy three configurations to the top
Yum install openssh-clients # scp installation package scp authkeys haresources ha. cf slave:/etc/ha. d/# All three configurations are vim ha copied from the master. cfdebugfile/var/log/ha-debug
Logfile/var/log/ha-log
Logfacility local0
Keepalive 2
Deadtime 30
Warntime 10
Initdead 60
Udpport 649
Ucast eth0 192.168.254.140 # Here, the ip address of the other party is 140.
Auto_failback on
Node master
Node slave
Ping 192.168.1.1
Respawn hacluster/usr/lib64/heartbeat/ipfail
4. Start (Master first and slave)
/Etc/init. d/heartbeat start
5. Test
MASTER:
Echo "11111111111111111 master">/usr/share/nginx/html/index.html
Iptables-a input-p icmp-j DROP
Iptables-d input-p icmp-j DROP
/Etc/init. d/heartbeat stop
From:
Echo "2222222222222 slave">/usr/share/nginx/html/index.html