Stopping and Starting Heartbeat


Now is a good time to practice starting and stopping Heartbeat on both the primary and backup machines to see what happens.

Go ahead and stop Heartbeat on the primary server with one of these commands:

 #/etc/init.d/heartbeat stop 

or

 #service heartbeat stop 

You should see the backup server declare that the primary server has failed, and then it should run the /etc/ha.d/resource.d/test script with the start argument. The /var/log/messages file on the backup server contain messages like these:

 backup.mydomain.com heartbeat[5725]: WARN: node primary.mydomain.com: is dead backup.mydomain.com heartbeat[5725]: info: Link primary.mydomain.com:eth1 dead. backup.mydomain.com heartbeat: info: Running /etc/ha.d/rc.d/status status backup.mydomain.com heartbeat: info: Running /etc/ha.d/rc.d/ifstat ifstat backup.mydomain.com heartbeat: info: Taking over resource group test *** /etc/ha.d/resource.d/test called with status backup.mydomain.com heartbeat: info: Acquiring resource group: primary.mydomain. com test backup.mydomain.com heartbeat: info: Running /etc/ha.d/resource.d/test start *** /etc/ha.d/resource.d/test called with start backup.mydomain.com heartbeat: info: mach_down takeover complete. 

The /etc/ha.d/resource.d/test resource or script was first called with the status argument and then with the start argument to complete the failover.

Once that's done, try starting Heartbeat on the primary server again, and watch what happens. The test script on the backup server should be called with the stop argument, and it should be called with the start argument on the primary server.[7]

Once you have performed these tests, you may also want to test other means of initiating a failover (such as unplugging the power or network connection on the primary server).

Note 

No failover will take place if heartbeat packets continue to arrive at the backup server. So, if you specified two paths for heartbeats in the /etc/ha.d/ha.cf file (a null modem serial cable and a crossover Ethernet cable, for example) unplugging only one of the physical paths will not cause a failover—both must be disconnected before a failover will be initiated by the backup server.

[7]This assumes you have enabled auto_failback, which will be discussed in Chapter 9.



The Linux Enterprise Cluster. Build a Highly Available Cluster with Commodity Hardware and Free Software
Linux Enterprise Cluster: Build a Highly Available Cluster with Commodity Hardware and Free Software
ISBN: 1593270364
EAN: 2147483647
Year: 2003
Pages: 219
Authors: Karl Kopper

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net