Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Ubuntu 10.10 host on which I installed VirtualBox VM. In VirtualBox, I have installed two other Ubuntu machines mainly with the same configuration. I am trying to achieve a High Availability cluster with two nodes (those 2 virtual machines) and I don't want to mix my Host machine in this project.

Now, I want to switch Apache service among those 2 virtual machines and for that I created a virtual host. I edit on both machines /etc/apache2/sites-available/mywebsite and add the following lines:

<VirtualHost 55.55.55.55:80>
 ServerAdmin support@mywebsite.com
 ServerName mywebsite.com
 DocumentRoot /var/www/mywebsite/
</VirtualHost>

This will give me the option to launch my website from 55.55.55.55 instead of http://localhost. But, this only works in my 2 nodes cluster and is not visible from my host machine. What can I do? Is there any solution ?

I am sorry for the long post, but I wanted to give you as many details as possible. Thanks

share|improve this question
    
the correct lines that I changed are:<VirtualHost 55.55.55.55:80> ServerAdmin support@truenature.com ServerName truenature.com DocumentRoot /var/www/truenature/ </VirtualHost> –  florin Mar 7 '11 at 9:37

1 Answer 1

up vote 0 down vote accepted

What you need is a load balancer. The load balancer uses a watchdog to monitor the availability of the real servers and sends the requests to the one which is alive.

[EDIT]

You have two options: Either the clients need to connect to another computer which forwards the requests to the running server (= load balancer) or you have to move the IP address when you switch servers.

You can assign several IP addresses to the same computer. I suggest to assign two: One which never changes (for remote administration) and one which you assign when you start apache on this host (that would be 55.55.55.55 in your case).

The alternative is to start Apache only on a single host and let the load balancer monitor this fact. Clients always connect to the load balancer. As long as only a single Apache service runs, the load balancer will always send all requests to just a single machine.

To assign an additional IP address, use this command:

ifconfig eth0:1 xxx.xxx.xxx.xxx

The ":1" says "additional address for eth0" (more information).

share|improve this answer
    
Hi again. what I want to achieve is failover IP not load balancing. I want to switch the apache service from one node to another in the cluster that I set up using heartbeat + pacemaker. The problem is, my cluster has 2 nodes (2 virtual machines). And apache works but I only can lunch the website from either one of the virtual machines, and I want to be able to lunch the website from the host machine. –  florin Mar 7 '11 at 10:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.