Heartbeat is the core http://linux-ha.org in HA projects, the HA (High Availability) abbreviation; it simply is to provide highly reliable application services, such as two to get the machine to do HA, providing WEB service , a loom based servers usually provide WEB services, HA is to ensure that a failure in the primary server (for example, power failure) when another machine can continue to provide WEB service to take over immediately, so that users do not feel the service has not been interrupted; Laboratory applications the machine may use more clustered.
Heartbeat can use the serial port or Ethernet to achieve the host monitor for convenience I use the Ethernet, the two machines were equipped with dual card, with a twisted pair cable to connect the two machines together, two NIC is connected to the routing; network configuration here is not to say, either the command line or a graphical interface Fedora network configuration is very easy. I configured here are:
PC1 (use this as the primary server):
After the network configuration is correct and then test the WEB service to check on whether the two machines can be used normally; everything is normal after use yum install Heartbeat:
yum install heartbeat
After installing the heartbeat begin configuring the three main configuration files are in: /usr/share/doc/heartbeat-2.1.3/ Next, we need to copy to manually modify /etc/ha.d/ in;
Edit authkeys file, the following configuration uses sha1 as the authentication method (It should be noted that the file permissions must be set to 600):
# 1 crc
2 sha1 HI!
# 3 md5 Hello!
keepalive 1 ## Setting heartbeat (monitoring) time is 1 second
warntime 10 ## set alarm time
deadtime 30 ## setting to determine the host downtime
initdead 120 ## First downtime
ucast eth1 10.0.0.2 ## eht1 do use the heart rate monitor is connected to two PC card
udpport 694 ## 694 using udp port monitoring heartbeat
Node 1 node f801 ## must be consistent with the results obtained by uname -n.
Node 2 node f802 ##
f801 192.168.1.118 httpd
IP hosts use 192.168.1.118 as WEB services, f801-based server.
After starting on the primary server configured Heartbeat:
service heartbeat start
Error, then the general problem of the configuration file, follow the prompts to modify it; Heartbeat will automatically start the appropriate service program based on haresource profile.
Then start Heartbeat on another tuner;
You can use tcpdump after configured to test the heartbeat between the two machines:
[Root @ f801 ~] # tcpdump -i eth0 -p udp port 694
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
11: 43: 46.431448 IP ha01.filenet-nch> ha02.ha-cluster: UDP, length 219
11: 43: 46.433968 IP ha01.filenet-nch> ha02.ha-cluster: UDP, length 216
11: 43: 47.431456 IP ha01.filenet-nch> ha02.ha-cluster: UDP, length 216
11: 43: 48.432516 IP ha01.filenet-nch> ha02.ha-cluster: UDP, length 216
If there is a problem, then the problem is likely to be a firewall, or in the configuration file ucast settings, you need to double check when I put ucast configuration where eth0 is set wrong.
Finally, you can do the test, turn off the main server, based on the profile in the response time, server PC2 will take over the tasks of the master server.