- Download the libnet and heartbeat source code, install it in all the nodes
Libnet source code (v1.1.2.1)is available @ http://www.packetfactory.net/libnet/
Heartbeat source code(v2.0.0) is available @ http://www.linux-ha.org/
The source package will install heartbeat's binaries to /usr/local/lib/heartbeat and the config files to /usr/local/etc/ha.d - Configure heartbeat in all the nodes
Create the file "ha.cf" in the /usr/local/etc/ha.d folder and type the following content.
debugfile /var/log/ha-debug
logfile /var/log/ha-log
node wsn03-99
node tser-linux-dev1 # List our cluster members
keepalive 1 # Send one heartbeat each second
deadtime 3 # Declare nodes dead after 3 seconds
bcast eth0 # Broadcast heartbeats on eth0 and eth1 interfaces
ping 192.168.3.253 # Ping our router to monitor ethernet connectivity
auto_failback no # Don't fail back to paul automatically
respawn hacluster /usr/local/lib/heartbeat/ipfail # Failover on network failures
node wsn03-99 and node tser-linux-dev1 is the host name of the node that returned by the command "uname -n" ,the line ping 192.168.3.253 is the router address.
Create the file "/usr/local/etc/ha.d/haresources" and type the following content
tser-linux-dev1 192.168.3.150 httpd
tser-linux-dev1 is the preferred host, the IP 192.168.3.150 is the virtual IP address and must not be used by any machine. "httpd" is the script name of the service that needed to be clustered, it must match the file in /etc/init.d or /usr/local/etc/ha.d/resource.d/
Create the file "/usr/local/etc/ha.d/authkeys" and type the following content
auth 1
1 sha1 key
The "key" is the authorized key generated by some utility, for sake of simpliclity I just put some value. Apply chmod 600 to this file
Finally, make sure all the nodes has the same set of files and heartbeat is ready to run. To start heartbeat type "network heartbeat start" - Configure Apache for clustering
In the apache's http.conf file, includes the following directivesListen {virtual-IP}:port-number
In addition, disable the startup service of apache in the
/etc/init.d because the heartbeat service will take control of it
Friday, October 20, 2006
Setup TCP/IP clustering with Linux's heartbeat
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment