Tag Archives: load balancer

Fixed my load balancer and got my new site on line

I’ve fixed the problem with my load balancer. The hard disk was completely dead, so I couldn’t execute any terminal commands. I just pulled the
plug and took out the hard disk. I replaced it with a hard disk from an old NAS, and reinstalled Lubuntu. I’m using Lubuntu because this PC
only has 512MB of RAM, so I need to save memory.

I installed Apache and set up mod proxy as described in this article about how I built my Raspberry Pi cluster.

While I was rebuilding the load balancer, my Raspberry Pi site was being hosted on a single Pi. Response times did suffer, but at least my site
wasn’t down completely.

This time when I set up Apache on the load balancer, I added the ServerName directive to the first virtual host:

<VirtualHost *:80>
 ServerName raspberrywebserver.com
...

 ProxyRequests Off
 <Proxy balancer://rpicluster>

 BalancerMember http://192.168.1.11:80 
 BalancerMember http://192.168.1.12:80 
 BalancerMember http://192.168.1.13:80 
 BalancerMember http://192.168.1.15:80 
 BalancerMember http://192.168.1.16:80 
 BalancerMember http://192.168.1.17:80 
 BalancerMember http://192.168.1.18:80 

 AllowOverride None 
 Order allow,deny 
 allow from all 

 ProxySet lbmethod=byrequests
 </Proxy>

...

</VirtualHost>

Next, I added a new virtual host section to the load balancer’s config:

<VirtualHost *:80>
 ServerName www.pyplate.com

 ProxyRequests Off
 ProxyPass / http://192.168.1.25/

 ErrorLog ${APACHE_LOG_DIR}/error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn

 CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

When the load balancer receives an HTTP request, it examines the domain name in the request to see which virtual host should handle the request. Requests for pages on raspberrywebserver.com are handled by the first virtual host which forwards requests to one of the nodes in the Pi cluster. Requests for pages on http://www.pyplate.com are handled by the second virtual host, which passes requests to a single server which holds the Pyplate web site. This server is a PC, so it’s a lot more powerful than the Raspberry Pi cluster.

I’m just about ready to begin beta testing. If you want to take a look at my new site, you can see it at www.pyplate.com. It’s brand new, so there may be teething problems.

I’ll announce beta testing on the Raspberry Pi forum tomorrow.

 

Advertisements

So close and yet so far

I’ve bought a new domain name, and I’ve pretty much finished building my new site. I still need to tweak the forum a little, but most of the work is done.

The next step is to adjust the settings on my reverse proxy. Currently it’s acting as a load balancer for my Raspberry Pi cluster.  I need to add another virtual host to the config file, which should be a simple enough procedure according to this site: http://www.integratedwebsystems.com/2010/06/multiple-web-servers-over-a-single-ip-using-apache-as-a-reverse-proxy/.

Unfortunately when I tried to do this, I found that the hard disk is failing badly. Every time I tried to use any bash command, I got a bunch of low-level errors about the hard disk. It’s amazing that Apache is still running – I guess it’s running from RAM. I suspect that if I try to restart it, my load balancer might not boot up again.

This is very annoying as I’m very close to launching my new site. I would probably have it on line by now, if it weren’t for this problem.

 

I’ve built a Raspberry Pi cluster and I’m using it to host my site

I’ve wanted to learn how to use a load balanced server for some time now.  I finally got around to buying more Pies so that I could build a cluster, and I’ve set up a PC as a load balancer.

Follow this link to  read the technical details about my Raspberry Pi server cluster.

raspberrypiservercluster

 

It was surprisingly simple to set up.  I hope to get more Pies to add to the cluster, but for the moment, it seems powerful enough.  My server has had over 2000 visitors so far today, and pages are still loading quickly.  I wasn’t sure if such a simple cluster could handle that much traffic, but I think there’s still quite a lot of spare capacity.