Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   linux server question (kinda hardcore) (http://www.greenguysboard.com/board/showthread.php?t=17931)

ATO 2005-03-25 09:05 AM

linux server question (kinda hardcore)
 
Been googleling all day - and hoped someone here might know something about my "problemo" ;)

At our office i have just bought a new server which is going to be our main webserver. The old webserver we want to be our backup server. So if the main server goes down we can just plugin the old server and then the site continue to run while we fix the new server. (Both servers actually run RAID1 - but expirence says you can never be to safe)

I have thought about 2 different solutions to the problem.

1. Having a script "clone" the new server onto the old server X times a day.
2. Setting the servers up in a cluster so it kinda also work as a loadbalanced system.

Im wondering if anyone have tried one of the solutions and could point me in the direction of some websites with more info about how to set it up.

I hope someone have some input for my little easter project ;)

cd34 2005-03-25 09:48 AM

You could rsync on a regular basis, and run mysql with replication. If someone is going to be there to swap the IP addresses, that's a pretty inexpensive way to do that.

You could run Coda or AFS or one of the other distributed filesystems (GFS from Sistina was purchased by RedHat and later released opensource in the RedHat packages). This would replicate the filesystems.

http://www.it.uc3m.es/ptb/fr1/
http://opengfs.sourceforge.net/
http://www.cubit.at/index.epl?cms_ol...ernkompetenzen

You could buy some ISCSI cards and have a shared storage machine that both shared, and turn off locking in mysql so that you could run mysql at the same time on both, and then flip the switch. You could set up an NFS shared storage machine (watch out for apache and its mmapped lock files if you use NFS)

Adaptec sells ISCSI cards that are fairly well supported in Linux.

Once you have the machines synced so that the data is identical on both, you could put a hardware load balancer in the front.

If you wanted something a little more automatic,
http://www.linux-ha.org/
http://www.linuxvirtualserver.org/
https://mcg.motorola.com/cfm/templat...&ProductID=202

Many different ways to do it.

raymor 2005-03-28 02:42 PM

Let's distinguish between a backup for your files and
a backup for your hardware.
If you want to backup the hardware it's very important
to keep the files in sync at all times.
Having things sort of a little bit in sync some of
the time leads to all kinds of trouble.
That does mean, though, that if your files
are lost or corrupted due to a hacker, an error, or whatever you'll
have two copies of the same bad files.
You'd then want a seperate backup copy
of the files that represent the state of the system at
a particular point in time.
The file backup should have two copies of the files always.
If you run it daily you'd have last night's backup
and the previous one at all times.
This is in case a hacker wipes out your system
5 minutes before the backup runs.
Again you don't want to just have a backup copy
of garbage.

NFS, AFS or some other network file system
as suggested by cd34 is one of the best ways to do a cluster
where you have two identical servers.
It may take a little tuning if the files change often
(many times per second), but it can be a solid,
high performance solution.

Another way is to use rsync with fam
to keep them synced in real time.
Do NOT rsync "occasionally" on a cluster.
That will create lots off problems.
On a cluster you keep them in sync at all
times, which is why you'd drive rsync with fam.
You could of course use rsync to create an occasional
offline backup, which should be treated just
like a backup tape.

Here's how to do a cluster with fam and rsync:
http://www.tldp.org/linuxfocus/Engli...ticle199.shtml

then what you can do is have a script on
the standby server check periodically to
see if the main server is responding.
If not, it sends a couple of gratuitous ARPs
to take over the IP address used for the web site.
Of course you'll want a different IP available on that
machine so that you can still try to SSH in and fix it.

ATO 2005-03-29 04:47 AM

Hey guys, thanks for the input - seems like i have some reading to do to check the various links out :)

ATO 2005-04-04 08:50 AM

how does the fam / rsync thingy work with databases.
as its important to replicate mysql also ;)

cd34 2005-04-04 10:06 AM

fam/rsync doesn't work with databases. Use Mysql Replication

Mysql 4.x is much easier to set up replication than 3.x used to be, and, Mysql 4.1 includes clustering which is the ultimate, but, isn't released as 'stable'.

devshed.org used to have a pretty good tutorial, but, I couldn't find it. Mysql's site isn't too bad with it.

With replication, you need to make sure you use atomic updates, although that's a pretty standard thing from a performance standpoint.

i.e.

update table set counter=counter+1 where domain_id=123;

rather than

select counter from table where domain_id=123;
php code to add 1 to $row['counter']
update table set counter=$row['counter'] where domain_id=123;

You'd be surprised how much code I run into that doesn't use atomic updates and they wonder why their stats are screwy.

other than that, once it is set, it is fire and forget. You can even shut down one machine or the other, and replication will spool things until the other server comes back.

ATO 2005-04-04 10:17 AM

Thx....

atm im looking into the http://www.linux-ha.org/ thingy - gonna crash a few machines at home tonight with it ;)


All times are GMT -4. The time now is 04:34 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc