VMware Images:
|
How To Set Up A Loadbalanced High-Availability Apache Cluster Based On Ubuntu 8.04 LTS - Page 3
10 Enable Packet Forwarding On The Load BalancersThe load balancers must be able to route traffic to the Apache nodes. Therefore we must enable packet forwarding on the load balancers. Add the following lines to /etc/sysctl.conf: loadb1/loadb2: vi /etc/sysctl.conf
Then do this: loadb1/loadb2: sysctl -p
11 Configure heartbeat And ldirectordNow we have to create three configuration files for heartbeat. They must be identical on loadb1 and loadb2! loadb1/loadb2: vi /etc/ha.d/ha.cf
Important: As nodenames we must use the output of uname -n on loadb1 and loadb2. loadb1/loadb2: vi /etc/ha.d/haresources
Please note that the last line above has my virtual IP which is: 192.168.0.105, my netmask is 255.255.255.0 and as its class C my IP should be followed by /24 then at the end my broadcast IP 192.168.0.255, please make sure you use the correct IP configuration. The first word in the first line above is the output of uname -n This file should be the same on both nodes, no matter if you start to create the file on loadb1 or loadb2! After IPaddr2 we put our virtual IP address 192.168.0.105. loadb1/loadb2: vi /etc/ha.d/authkeys
somerandomstring is a password which the two heartbeat daemons on loadb1 and loadb2 use to authenticate against each other. Use your own string here. You have the choice between three authentication mechanisms. I use md5 as I believe it is the most secure one. /etc/ha.d/authkeys should be readable by root only, therefore we do this: loadb1/loadb2: chmod 600 /etc/ha.d/authkeys ldirectord is the actual load balancer. We are going to configure our two load balancers (loadb1.tm.local and loadb2.tm.local) in an active/passive setup, which means we have one active load balancer, and the other one is a hot-standby and becomes active if the active one fails. To make it work, we must create the ldirectord configuration file /etc/ha.d/ldirectord.cf which again must be identical on loadb1 and loadb2. loadb1/loadb2: vi /etc/ha.d/ldirectord.cf
In the virtual= line we put our virtual IP address (192.168.0.105 in this example), and in the real= lines we list the IP addresses of our Apache nodes (192.168.0.103 and 192.168.0.104 in this example). In the request= line we list the name of a file on webserver1 and webserver2 that ldirectord will request repeatedly to see if webserver1 and webserver2 are still alive. That file (that we are going to create later on) must contain the string listed in the receive= line. Afterwards we create the system startup links for heartbeat and remove those of ldirectord because ldirectord will be started by the heartbeat daemon: loadb1/loadb2: update-rc.d heartbeat start 75 2 3 4
5 . stop 05 0 1 6 . Finally we start heartbeat (and with it ldirectord): loadb1/loadb2: /etc/init.d/ldirectord stop
|




print: 
Recent comments
3 hours 34 min ago
5 hours 3 min ago
6 hours 12 min ago
10 hours 20 min ago
13 hours 36 min ago
13 hours 50 min ago
16 hours 57 min ago
17 hours 50 min ago
18 hours 15 min ago
20 hours 34 min ago