HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Loadbalanced High-Availability Apache Cluster (http://www.howtoforge.com/forums/showthread.php?t=11881)

manurro 4th April 2007 12:56

Loadbalanced High-Availability Apache Cluster
 
Hi all,

I'm building a Loadbalanced HA Apache Cluster following the HOW-TO from Falko.
I've done everything as he explained just changing my nodenames and IP's, and it all seems to be fine, but when I start heartbeat on both loadb servers, they both become active, when they're supposed to be one active and the other on hot-standby. I've checked config files a thousand times and I can't guess what's going wrong. Below I attach my config files on load balancers.

LOADB1 & LOADB2 (as config files must be identical)

/etc/ha.d/ha.conf

Code:

logfacility    local0
bcast  eth0
mcast  eth0 225.0.0.1 694 1 0
auto_failback on
node loadb1.mydomain.com
node loadb2.mydomain.com
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster

/etc/ha.d/haresources

Code:

loadb1.mydomain.com ldirectord::ldirectord.cf LVSSyncDaemonSwap::master IPaddr2::xxx.xxx.xxx.xxx/27/eth0/nnn.nnn.nnn.nnn
(Where xxx.xxx.xxx.xxx is the VIP and nnn.nnn.nnn.nnn the network address)

/etc/ha.d/ldirectord.cf

Code:

checktimeout=10
checkinterval=2
autoreload=no
logfile="local0"
quiescent=yes

virtual=xxx.xxx.xxx.xxx:80
        real=yyy.yyy.yyy.yyy:80 gate
        real=zzz.zzz.zzz.zzz:80 gate
        fallback=127.0.0.1:80 gate
        service=http
        request="ldirector.html"
        receive="Test Page"
        scheduler=rr
        protocol=tcp
        checktype=negotiate

(yyy.yyy.yyy.yyy and zzz.zzz.zzz.zzz are the apache nodes)

That's the output a few seconds after I started heartbeat on both servers:

Loadb1

Code:

# ip addr sh eth0
2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:17:08:50:3e:f6 brd ff:ff:ff:ff:ff:ff
    inet aaa.aaa.aaa.aaa/27 brd nnn.nnn.nnn.nnn scope global eth0
    inet xxx.xxx.xxx.xxx/27 brd nnn.nnn.nnn.nnn scope global secondary eth0
    inet6 fe80::217:8ff:fe50:3ef6/64 scope link
      valid_lft forever preferred_lft forever

Loadb2

Code:

# ip addr sh eth0
2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:16:35:5c:f8:f4 brd ff:ff:ff:ff:ff:ff
    inet bbb.bbb.bbb.bbb/27 brd nnn.nnn.nnn.nnn scope global eth0
    inet xxx.xxx.xxx.xxx/27 brd nnn.nnn.nnn.nnn scope global secondary eth0
    inet6 fe80::217:8ff:fe50:3ef6/64 scope link
      valid_lft forever preferred_lft forever

(aaa.aaa.aaa.aaa and bbb.bbb.bbb.bbb are the adrresses for loadb1 and loadb2).

My OS is Fedora Core 5 on all servers (load balancers and apache nodes).
Please anyone can help me?

Thanks in advance.

manurro 5th April 2007 11:28

OK, it was an IPTABLES issue, I should have checked that before :o

For those who may have same issue, adding that to iptables config file fixed my problem:
Loadb1
Code:

-A RH-Firewall-1-INPUT -p ip -m comment -m state -s bbb.bbb.bbb.bbb --state NEW -j ACCEPT --comment Hearbeat
-A RH-Firewall-1-INPUT -p ip -m comment -m state -s xxx.xxx.xxx.xxx --state NEW -j ACCEPT --comment Hearbeat

Loadb2
Code:

-A RH-Firewall-1-INPUT -p ip -m comment -m state -s aaa.aaa.aaa.aaa --state NEW -j ACCEPT --comment Hearbeat
-A RH-Firewall-1-INPUT -p ip -m comment -m state -s xxx.xxx.xxx.xxx --state NEW -j ACCEPT --comment Hearbeat

(aaa.aaa.aaa.aaa is loadb1's IP, bbb.bbb.bbb.bbb loadb2's IP and xxx.xxx.xxx.xxx is the virtual IP)

Regards!

pajatzo 9th April 2007 17:29

Virtual IP on two machines
 
Hi all

Iíve just completed the howto, and one thing hit me. If the two apache nodes answer to the reply on the new virtual address, whatís from stopping the network traffic to get to them directly? If I stop the ldirectord and ultra monkey on the load balancer the setup still works, I get an error the first time I load the virtual URL but the second time I get in contact with one server. Does this present some error to the setup that I havenít understood? Is the apache nodes supposed to sit on a private network behind the load balancers? Do I need two NICs in the load balancers?

I must also say that I havenít followed the howto exactly; I have done it with a twist you might say. The two apache nodes run FreeBSD and the NICs on those machines have there real address and an alias with the virtual address.

falko 10th April 2007 15:46

Quote:

Originally Posted by pajatzo
whatís from stopping the network traffic to get to them directly?

Nothing, the nodes can still answer on their own IP addresses.

Quote:

Originally Posted by pajatzo
Is the apache nodes supposed to sit on a private network behind the load balancers?

Not necessarily. But it will be more difficult to configure a virtual IP address with public IP addresses, whereas you can do whatever you want with private IP addresses.


Quote:

Originally Posted by pajatzo
Do I need two NICs in the load balancers?

If you load balancers should have a public and private IP address at the same time, then yes.

pajatzo 10th April 2007 15:59

Quote:

Originally Posted by falko
Nothing, the nodes can still answer on their own IP addresses.

Yes but they will also answer on the virtual chared IP address, correct? They will be reachably by two adresses each.

Can you also specify if the arp... changes to the kernel on the apache nodes apply to ignore warnings about several machines on the network using the same IP, this is an error that I get on the nodes, running FreeBSD.


All times are GMT +2. The time now is 10:23.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.