LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-22-2008, 05:20 PM   #1
ptemmerman
Member
 
Registered: Oct 2008
Location: Spain
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
Heartbeat + ldirectord


Hi Guys.

I've been given the task to create a load balanced high availability apache webserver. Since I didn't have any experience with this I investigated several projects suchs as Linux-HA, Heartbeat, Linux Virtual Server and ldirectord.

The examples and tutorials I found were all based on 4 servers:

- Server1: Main load balancer
- Server2: Backup load balancer
- Server3: Apache1
- Server4: Apache2

Based on the tutorials that I read, things looked pretty straightforward. However, I have been experiencing some problems, which I think, are due to the fact that I only have two servers:

- Server1: Main load balancer + Apache1
- Server2: Backup load balancer + Apache2

I have a virtual IP address 172.16.0.50 which eventually redirects to either server1 (172.16.0.30) or server2 (172.16.0.40).

I can see that the heartbeat infrastructure works, as server2 takes over from server1 if the latter goes down and vice versa. I can tell by executing:

Code:
ip addr sh eth0
It shows that the network card now has the virtual IP address (172.16.0.50) assigned, which was not the case when the main server was active.

Now according to the manuals I have read, I need to assign the virtual IP address to an alias on localhost, in order for the apache servers to accept traffic on the virtual IP.

Code:
ifconfig lo:0 172.16.0.50 netmask 255.255.254.0
ifconfig now shows that alias lo:0 has the virtual IP address.

For clarity, this is the current setup:

Code:
Server1: 
eth0: 172.16.0.30
lo:0 172.16.0.50

Server2:
eth0: 172.16.0.40
lo:0 172.16.0.50
Now I have 2 problems:

1. The next time I start heartbeat, it fails to start because the virtual IP address already exists. After I remove alias lo:0, heartbeat starts normally again. But then I need to create the alias again, otherwise apache is not able to accept any connections.

2. When the apache server which resides on the same server as the load balancer goes down (server1), then heartbeat (ldirectord actually) sets apache2 on server2 as the main one. In this setup I'm unable to connect to the apache server through the virtual IP address.
Could it be that the linux internal routing is still trying to forward the traffic to the apache server that is down, due to the fact that the localhost alias lo:0 is still active?

server1 (has virtual ip set on lo:0) ---> apache2 (on server2)

Any help is kindly appreciated.


Thanks.


P.S.: I'm not able to post any config files atm since I'm not in front of the server. I will be able to do so in a couple of hours, if necessary.

Last edited by ptemmerman; 10-22-2008 at 05:22 PM.
 
Old 10-23-2008, 05:47 AM   #2
ptemmerman
Member
 
Registered: Oct 2008
Location: Spain
Distribution: Ubuntu
Posts: 75

Original Poster
Rep: Reputation: 15
Problem 1) is resolved.
Remains problems 2)

Some more info:

When starting heartbeat, it creates an alias on eth0 with the virtual IP.
The apache server (which is running on the same server as heartbeat) requires the virtual IP to be set as an alias on lo:0 in order to be able to accept traffic on the virtual IP address.

I'm more and more convinced that the two virtual IP aliases are causing my troubles:

When I have my second server in standby mode (means the first server is distributing the VIP (virtual IP) traffic to the corresponding apache server) then ipvsadm -L returns:

Quote:
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
Which is the correct behavior.
The thing is that I didnīt have the VIP set on lo:0 on the second server. (Thus apache is not receiving petitions).
When I set the VIP on lo:0 and run ipvsadm -L again, I get:

Quote:
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 172.16.0.50:80 rr
-> 172.16.0.40:80 Local 0 0 0
-> 172.16.0.30:80 Local 0 0 0
It seems that heartbeat on the second server gets confused with the two VIPs and is unable to contact the master heartbeat server anymore. Thus it thinks it is down and activates itself as primary heartbeat server.

Also note that according to ipvsadm both real servers are "LOCAL" ??

I'm puzzled with this.

Last edited by ptemmerman; 10-23-2008 at 05:49 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
heartbeat cluster help ufmale Linux - Server 3 05-23-2008 07:16 PM
Heartbeat with groupwise prajakta0shimpi Linux - Server 0 04-09-2008 04:19 AM
drbd heartbeat saavik Linux - Networking 0 11-29-2005 09:56 AM
ldirectord initialization error depdiver Linux - Software 0 05-12-2005 04:38 PM
squid with ldirectord---------------- pal Linux - Networking 0 02-22-2005 12:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration