Web Hosting Talk







View Full Version : Best way to bckup to prevent downtime???


kwes43
05-07-2003, 03:41 AM
Looking to find out the best way to backup my dedicated servers in case of downtime due to hardware failure or DC failures.
Best way meaning most cost efficient way:pimp:

Any ideas?

RH4U
05-07-2003, 04:41 AM
Ask for your server to be hooked up to a UPS of sorts, this will cost.

Ask for a remote reboot port so you can perform your own reboots when and if needed.

As far as parts you are probably going to have to depend on them, if uptime is a must i would go with a managed solution that will solve all your problems mostly OR co-location and send extra parts for emergency situations, etc.

stephenM
05-07-2003, 04:55 AM
I think he meant back up his files..?

RH4U
05-07-2003, 06:35 AM
Oh, i misunderstood the post then, sorry..

kwes43
05-07-2003, 07:02 AM
Sorry...should have been more specific. I need a cost effeicient method of backing up the data on my servers to a remote location that will provide for quick and easy recovery so that I can minimize any downtime.

Any ideas?

RH4U
05-07-2003, 07:46 AM
You want something like RAID or an off server solution? You said remote location so im assuming that you mean off server..

There are some companies that do this that can provide you with an automated hands off solution that they will deal with.. however they usually charge between $75-200 dollars per 50-100GB of compressed data backed up..

So depending on what your looking for you might want just get a second server and set it up somehow as a backup?
I found these companies by going to www.google.com and typing in server backup...

But, if your willing to do it yourself you could setup a second server for backup. Of course the server being on a second network would be preferred..

heyzuess
05-07-2003, 08:02 AM
I wrote a shell script to dump the mysql db's, tar up important directories (like /home, /var/named, /etc, et cetera) and then using ssh, rsync the tarballs over to a remote box.


Hopefully that will give me everything I need to get back up and running in a short amount of time should something catastrophic happen.

I'm sure there are probably more elaborate ways of doing it though....

kwes43
05-07-2003, 08:38 AM
So heyzues and RH4U,

If I get a second server at another data center to back up to using rsync--
How many servers(80G HD) could I back up on to the one server(80G HD)?
How long would it take to restore?

stephenM
05-07-2003, 08:40 AM
Originally posted by heyzuess
I wrote a shell script to dump the mysql db's, tar up important directories (like /home, /var/named, /etc, et cetera) and then using ssh, rsync the tarballs over to a remote box.


Hopefully that will give me everything I need to get back up and running in a short amount of time should something catastrophic happen.

I'm sure there are probably more elaborate ways of doing it though....

Are you willing to share that script? ;)

heyzuess
05-07-2003, 09:05 AM
First I used this as a guide, especially for setting up the ssh keys:

http://killyridols.net/rsyncssh.shtml

That was also the overall basis for what I did:



#!/bin/sh

# set some variables....

HOMEDIR=`ls /home`
BACKUPDIR="/usr/local/backups"
HOSTNAME=`hostname`
DAY=`date +%A`
REMOTESERVER="remote.blah.com"

# backup mysql

for d in `mysql -B -N -e "show databases" -pPASSWORD`; do
mysqldump --user root --password=PASSWORD $d | gzip -9 > $BACKUPDIR/mysql/sqldumps/$d.sql.gz
done


# stop cyrus and backup imap spooldir to tarball in local backup dir

/etc/init.d/cyrus stop
tar czvf $BACKUPDIR/imap/imap-spool.tar.gz /var/spool/imap
/etc/init.d/cyrus start


# tar up each home dir to local backup dir

for h in $HOMEDIR; do
tar czvf $BACKUPDIR/home/$h.tar.gz /home/$h
done

tar czvf $BACKUPDIR/misc/etc.tar.gz /etc
tar czvf $BACKUPDIR/misc/var-named.tar.gz /var/named
tar czvf $BACKUPDIR/misc/var-imap.tar.gz /var/lib/imap
tar czvf $BACKUPDIR/misc/usr-sieve.tar.gz /usr/sieve

# rsync everything out to a safe place

/usr/bin/rsync -e ssh -avzp --exclude "*.journal" --exclude "dnscache/" --exclude "dnscachex/" --delete $BACKUPDIR $REMOTESERVER:/home/backup/$HOSTNAME/$DAY

# delete tarballs left laying on system

rm -f /usr/local/backups/home/*
rm -f /usr/local/backups/imap/*
rm -r /usr/local/backups/mysql/sqldumps/*
rm -f /usr/local/backups/misc/*



You'll of course have to modify some of it to suit your specific needs. (I use cyrus imapd for example).

I've setup the script to run from crontab with root privliges (needed to backup the home dirs and all without hassle), and on the remote box I've setup a user called "backup" that root logs into when using ssh - that's all the permission needed over there.

Hope that helps.

kwes43
05-07-2003, 09:46 AM
Originally posted by heyzuess
First I used this as a guide, especially for setting up the ssh keys:

http://killyridols.net/rsyncssh.shtml

That was also the overall basis for what I did:



#!/bin/sh

# set some variables....

HOMEDIR=`ls /home`
BACKUPDIR="/usr/local/backups"
HOSTNAME=`hostname`
DAY=`date +%A`
REMOTESERVER="remote.blah.com"

# backup mysql

for d in `mysql -B -N -e "show databases" -pPASSWORD`; do
mysqldump --user root --password=PASSWORD $d | gzip -9 > $BACKUPDIR/mysql/sqldumps/$d.sql.gz
done


# stop cyrus and backup imap spooldir to tarball in local backup dir

/etc/init.d/cyrus stop
tar czvf $BACKUPDIR/imap/imap-spool.tar.gz /var/spool/imap
/etc/init.d/cyrus start


# tar up each home dir to local backup dir

for h in $HOMEDIR; do
tar czvf $BACKUPDIR/home/$h.tar.gz /home/$h
done

tar czvf $BACKUPDIR/misc/etc.tar.gz /etc
tar czvf $BACKUPDIR/misc/var-named.tar.gz /var/named
tar czvf $BACKUPDIR/misc/var-imap.tar.gz /var/lib/imap
tar czvf $BACKUPDIR/misc/usr-sieve.tar.gz /usr/sieve

# rsync everything out to a safe place

/usr/bin/rsync -e ssh -avzp --exclude "*.journal" --exclude "dnscache/" --exclude "dnscachex/" --delete $BACKUPDIR $REMOTESERVER:/home/backup/$HOSTNAME/$DAY

# delete tarballs left laying on system

rm -f /usr/local/backups/home/*
rm -f /usr/local/backups/imap/*
rm -r /usr/local/backups/mysql/sqldumps/*
rm -f /usr/local/backups/misc/*



You'll of course have to modify some of it to suit your specific needs. (I use cyrus imapd for example).

I've setup the script to run from crontab with root privliges (needed to backup the home dirs and all without hassle), and on the remote box I've setup a user called "backup" that root logs into when using ssh - that's all the permission needed over there.

Hope that helps.

Does this backup to another location (i.e. different data center)?
Do you back up multiple servers to one server?
How long does it take to restore--and where do you restore to (do you purchase another server)?

heyzuess
05-07-2003, 09:59 AM
Originally posted by kwes43
Does this backup to another location (i.e. different data center)?
Do you back up multiple servers to one server?
How long does it take to restore--and where do you restore to (do you purchase another server)?


Yes, it backs up to another server in another DC - you set that in REMOTESERVER.

And yes, you can have multiple servers backup to the one remote one. On the remote one you just need a directory for each one, ie: /home/backup/server1 and /home/backup/server2

but use the actual host names instead of server1 and server2.

But please note: This isn't an automate disaster recovery system. It's just a simple way to backup important data offsite. If I did need to do a complete system restore I would have all the data needed, but I'd still have to manually run through everything. But that's ok - I'm comfortable with it.

kwes43
05-07-2003, 01:36 PM
That is really what I want to do. I want to automate disaster recovery or be able to quickly restore all sites in case of a hard drive crash or DC downtime of some sort?

Could anyone please explain the options I have for this or point me in the right direction?:confused:

kwes43
05-07-2003, 07:15 PM
Originally posted by kwes43
That is really what I want to do. I want to automate disaster recovery or be able to quickly restore all sites in case of a hard drive crash or DC downtime of some sort?

Could anyone please explain the options I have for this or point me in the right direction?:confused:

demonmoo
05-07-2003, 08:13 PM
Get a second dedicated server , rsync with it nightly (or more frequently) use zoneedits round robin dns system and fallover so that when the other server goes down (we all know it will eventually) it only has about 4 minutes of downtime :-)

kwes43
05-07-2003, 09:29 PM
Originally posted by demonmoo
Get a second dedicated server , rsync with it nightly (or more frequently) use zoneedits round robin dns system and fallover so that when the other server goes down (we all know it will eventually) it only has about 4 minutes of downtime :-)

Yea, that's what I'm looking for!
Is this hard to do and do you have more than one server backing up to other server or do you have it set up a mirror?