Installation environment, requires two units equipped with Centos6.5 x86_64 machine, the network card can be two pieces per machine, can also be one piece. This article is a network card.
Package preparation (from Rpm.phone.net):
pwd/root/lsheartbeat-3.0. 4-2. el6.x86_64.rpm heartbeat-devel-3.0. 4-2. el6.x86_64.rpm heartbeat-libs-3.0. 4-2. el6.x86_64.rpm
Installation:
Yum localinstall *.rpm-y
Modify the host file to add at the end of the/etc/hosts file:
172.16. 7.153 Demo0 172.16. 7.150 Demo1
Copy the configuration file:
[Email protected] soft]# cd/usr/share/doc/heartbeat-3.0. 4/[[email protected] heartbeat-3.0. 4cp HA.CF Authkeys haresources/etc/ha.d/
To start configuring/ETC/HA.D/HA.CF:
# Debug Log location #debugfile/var/log/ha-debug## Log Location #logfile/var/log/ha-log### Facility to use forSyslog ()/Logger #logfacility local0## Set the time interval between heartbeat to 2 seconds. #keepalive2# # After 30 seconds the node is declared dead. #deadtime -# # The time, in seconds, to wait before issuing a "late heartbeat" warning in the log. #warntimeTen# # In some configurations, it takes some time for the network to work properly after a reboot. # This individual "deadtime" option can handle this situation. # its value should be at least twice times the usual deadtime. #initdead -# # Use port 694 for bcast and ucast communication. This is the default and is officially registered in the IANA port number. #udpport694# # Broadcast address #bcast eth0 # linux## default after the reply automatically failback #auto_failback on# # There are two nodes installed heartbeat. Demo0,demo1 is our The Hosts file is configured in the #node demo0node demo1## to test the node's network connectivity, the machine is demo0 on ping demo1, this machine is demo1 on ping demo0#PingDemo1
To start configuring/etc/ha.d/authkeys:
# # Identity certificate file. The permission must be 600.### to have only one authentication directive in front. # auth Send authentication using this method for a list of id## encryption methods and keys they are used according to the method ID. # # Valid encryption method: CRC SHA1, MD5. CRC is not required or does not want to use encryption. # # You usually have only one authentication method ID listed in this file # #more make a smooth transition When changing auth# methodsand/or keys.### SHA1 is the best option, MD5 second. # 21 CRC2 SHA1 hi! 3 MD5 hello!
To modify access permissions for a file:
chmod /etc/ha.d/authkeys
Last configuration haresources:
# # Configure a virtual IP, let these two nodes for its search, this IP must be not occupied by others. #demo0 ipaddr::172.16. 7.210//eth0
all two machines need to do the above and open 694 ports inside the firewall. Note: The last line of/ETC/HA.D/HA.CF, two machines are not the same, you need to pay attention to.
Both machines start the heartbeat service and the installation is complete.
172.16.7.210 is an external IP, when both machines Demo0 (172.16.7.153), Demo1 (172.16.7.150) are normal, 210 points to demo0, when Demo0 fails, 210 points to demo1. When Demo0 returns to normal, 210 points to demo0.
Service Heartbeat start
Centos 6.5 Installation Heartbeat