Help - Search - Members - Calendar
Full Version: Is anyone using cpanel with server load balancing?
The Planet Forums > System Administration > Load Balancing
terry99
Is anyone using cpanel with server load balancing?

Does it work?
alex.davies
QUOTE
Originally posted by terry99
Does it work?

It would work. You would just have to set the two servers up identically and use rsync to keep them up to date. If you use mysql then replication works a treat. I run it using Red Hat Enterprise (which is what cpanel is sitting on top of) and it works fine.

Alex
terry99
Really rsync? Thats not instant, would that work for like 100gigs of data?

Wouldn't unison be better?
http://forum.ev1servers.net/showthread.php...&threadid=49554
alex.davies
QUOTE
Originally posted by terry99
Really rsync?  Thats not instant, would that work for like 100gigs of data?

Wouldn't unison be better?
http://forum.ev1servers.net/showthread.php...&threadid=49554


It depends how you want it. If you look at My HOWTO you can see how to set up both. I have ended up using unison .

If you want one primary server that you do all the FTP and make all the DB changes to, then you want rsync and mysql replication.

If you want a totally redundent solution (i.e. you can use either server for anything) you want unison, mysql cluster (new in 4.1; google it) and a clever mail setup.

In each case I suggest you set the servers up identically as far as cpanel goes, and just rsync/unison the data directories. To answer your question both should be able to handle 100G of data, although I would not suggest you run them very often (perhaps once an hour)?

Alex
terry99
What files do you rsync? Everything in / or just /home /var/lib/mysql /usr/local /etc/passwd, etc?
alex.davies
QUOTE
Originally posted by terry99
What files do you rsync?  Everything in / or just /home /var/lib/mysql /usr/local /etc/passwd, etc?


Me, myself, just sync /www with unison. This is because I have each server in my cluster set up (slightly) differently for various reasons and I have set them up manually.

You could sync the whole of /home if you wanted to. You could also sync config files but I personally like the ability to test a change on one server before rolling it out to other servers!

BTW do NOT try to sync the mysql data directory. Use MySQL replication or mysql clustering pm me if you want a hand setting this up.

Alex
terry99
Are you using cpanel?

So you are just syncing /home/username/www ?

Is it best to use a seperate server for mysql?

What do you do for backups?
alex.davies
I am not currently using cpanel - because I am only running one (high-load, high availbility) site on my server.

I have the webroot in /www.

I have mysql installed on localhost using replication (my site is such that all updates are done by a small number of users, who go to one server rather than the loadbalancer).

My setup is slightly more complex because this site is actually spread over 4 servers in two load balanced pairs (only one with EV1) to ensure 100% uptime.

I am looking into setting up a mysql cluster (a new feature of mysql) and will probably pluck up courage to do it early next year. This would allow updates to be made from each server even though it is running a seperate version of mysql. A seperate mysql server is probably unnecessary unless you have a lot of traffic. Get a dual driver cluster and run mysql on the second drive and you will solve all your I/O problems (which is what most mysql load problems are).

If you want to ask me any more questions please feel free to email or pm me: alex at davz.net.

Alex
terry99
Thanks!
terry99
With uinson or rsync is it possible for corrupt files to be transfered? What if something was writing to httpd.conf at the exact moment uinson or rsync was copying it?
alex.davies
QUOTE
Originally posted by terry99
With uinson or rsync is it possible for corrupt files to be transfered?  What if something was writing to httpd.conf at the exact moment uinson or rsync was copying it?


I think that unison skips files that something else has a write lock on until the next time it runs.

Alex
terry99
Thanks 1 more q.

When someone FTP's to there site or makes changes, then do they have to wait upto an hour for the changes to fully take effect? As the load balancer will route the traffic automatically to the server with the lowest load?

With load balancing does it only sync a -> b or does it do a -> b and b -> a ?
alex.davies
QUOTE
Originally posted by terry99
When someone FTP's to there site or makes changes, then do they have to wait upto an hour for the changes to fully take effect?  As the load balancer will route the traffic automatically to the server with the lowest load?

I think that it is least concurent connections. So the server that is dealing with the fewest number of visitors gets the next request. This is similar to (but not the same as) the least load.

I am lucky in that my site does not change very often (i.e. the scripts do not change). If you were updating static content, i.e. HTML or PHP scripts, then it would take an hour or so to update the other server.

If you are using scripts (i.e. pulling stuff out of databases) then mysql replication handles this within a few seconds (max.).

QUOTE
Originally posted by terry99
With load balancing does it only sync a -> b or does it do a -> b and b -> a ?

Load balancing is simple. Basically you are given two servers each with an IP address. You are also given another IP address which is the IP address of the loadbalancer.

You point your visitors (i.e. set the DNS to) the IP address of the loadbalancer. This then sends the visitors to each server transparantly. The same visitor will remain with the same server unless the server dies.

If you can pm/email me your exact scenario (i.e. what site(s) you are planning on hosting and what it consists of) I will be able to tell you with more accuracy if a loadbalanced cluster is for you.

Alex
terry99
So clients would have to make changes to there site on only one server and always make changes on that server, then rsync and unison would replicate that data on the second server. Right?
alex.davies
QUOTE
Originally posted by terry99
So clients would have to make changes to there site on only one server and always make changes on that server, then rsync and unison would replicate that data on the second server. Right?

If you used rsync, yes.

If you use unison they could update either server and it would "merge" the changes. I personally prefer the former because it prevents two people editing the same file on each server at the same time (which causes major problems, as you can imagine!).

Alex
terry99
What is the best way to replicate mysql on a mysql server running 4.0.22 as 4.1 is not supported by cpanel?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.