Heartbeat provides us with a low-cost, scalable, highly available cluster solution. We create a highly available (HA) clustered server under Linux via Heartbeat+drbd+nfs.
A DRBD is a block device that can be used in high availability (HA). It is similar to a network RAID-1 function. When you write data to the local file system, the data will also be sent to another host on the network. Recorded in a file system in the same form. Data from the local (primary) and remote host (standby node) can be synchronized in real time. When the local system fails, the remote host retains the same data and can continue to use it.
Two Case topology:
A Heratbeat Configuration
1. Modify the Hosts file
[Root@node1 ~]# vim/etc/hosts
127.0.0.1 localhost.localdomain localhost
:: 1 localhost6.localdomain6 Localhost6
192.168.10.1 node1.a.com
192.168.10.2 node2.a.com
2. Modify the Network file
[Root@node1 ~]# hostname node1.a.com
[Root@node1 ~]# Vim/etc/sysconfig/network
Networking=yes
Networking_ipv6=no
Hostname=localhost.localdomain
Nisdomain=node1.a.com
3. Configure the Yum source
[Root@node1 ~]# hwclock-s//Sync time
[Root@node1 ~]# Mkdir/mnt/cdrom
[Root@node1 ~]# Mount/dev/cdrom/mnt/cdrom
[Root@node1 ~]# Vim/etc/yum.repos.d/rhel-debuginfo.repo
[Rhel-server]
name=red Hat Enterprise Linux Server
Baseurl=file:///mnt/cdrom/server
Enabled=1
Gpgcheck=0
Gpgkey=file:///mnt/cdrom/rpm-gpg-key-redhat-release
[Rhel-cluster]
name=red Hat Enterprise Linux Cluster
Baseurl=file:///mnt/cdrom/cluster
Enabled=1
Gpgcheck=0
Gpgkey=file:///mnt/cdrom/rpm-gpg-key-redhat-release
The Node1 is the same as the Node2 configuration.
[Root@node1 ~]# Scp/etc/yum.repos.d/rhel-debuginfo.repo node2.a.com:/etc/yum.repos.d/
Heartbeat
4. The package required to install the heartbeat.
[Root@node1 ~]# yum Localinstall heartbeat-2.1.4-9.el5.i386.rpm heartbeat-lnoded-2.1.4-9.el5.i386.rpm heartbeat-pils-2.1.4-10.el5.i386.rpm heartbeat-stonith-2.1.4-10.el5.i386.rpm libnet-1.1.4-3.el5.i386.rpm perl-mailtools-1.77-1.el5.noarch.rpm--nogpgcheck-y
[Root@node1 ~]# cd/usr/share/doc/heartbeat-2.1.4/
[Root@node1 heartbeat-2.1.4]# cp Authkeys haresources ha.cf/etc/ha.d/
[Root@node1 heartbeat-2.1.4]# Vim HA.CF
Bcast eth1//generating broadcast monitoring eth1
213 node node1.a.com//define Nodes
214 Node node2.a.com