Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   What to backup? (http://www.linux-archive.org/centos/330937-what-backup.html)

John R Pierce 02-23-2010 11:06 PM

What to backup?
 
Slack-Moehrle wrote:
> Hi All,
>
> I am now working on a plan of what to backup from various servers that I have running
>
> I run Apache, so httpd.conf and /var/www/html
>
> I run Zimbra currently, so /opt/zimbra/store, /opt/zimbra/my.cnf and /opt/zimbra/db/
>
> I run MySQL, so /etc/my.cnf and /var/lib/mysql
>
> Can I simply write a bash script to tar.gz these areas, scp them and put it in a cron job?
>
> Is there anything special that I have to do with MySQL since it is running?
>
>

for centos apache, you'll want everything in /etc/httpd/...

and, my websites other than the default one are generally in
/home/someaccount/html as I dont like having /var get that big.

for mysql, you'll want to do a dump of your databases, and backup that
dumpfile, rather than backing up the filestore.
the only safe way to do a file level backup of a database server's
backing store is to stop the sql server, then back it up.

I dunno anything about zimbra.

you probably also want to backup your /home dirs


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Robert Heller 02-23-2010 11:08 PM

What to backup?
 
At Tue, 23 Feb 2010 15:48:24 -0800 (PST) CentOS mailing list <centos@centos.org> wrote:

>
> Hi All,
>
> I am now working on a plan of what to backup from various servers that I have running
>
> I run Apache, so httpd.conf and /var/www/html
>
> I run Zimbra currently, so /opt/zimbra/store, /opt/zimbra/my.cnf and /opt/zimbra/db/
>
> I run MySQL, so /etc/my.cnf and /var/lib/mysql
>
> Can I simply write a bash script to tar.gz these areas, scp them and put it in a cron job?
>
> Is there anything special that I have to do with MySQL since it is running?
>
> If helpful, I can take what I learn and update the Wiki if there is not already a procedure for doing these operations on it.

What *I'd* do, is have separate partitions for /, /var /opt and /home.
And do a monthy full dump of each file system, weekly incremental dumps
of /var and /opt, and daily or every other day incremental dumps of
/home. It is probably iffy to get a meaningful dump of mysql's running
database. It probably makes better sense to do a SQL dump -- 'man
mysqldump'.

>
> -Jason
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
heller@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Benjamin Franz 02-23-2010 11:29 PM

What to backup?
 
Robert Heller wrote:
> What *I'd* do, is have separate partitions for /, /var /opt and /home.
> And do a monthy full dump of each file system, weekly incremental dumps
> of /var and /opt, and daily or every other day incremental dumps of
> /home. It is probably iffy to get a meaningful dump of mysql's running
> database. It probably makes better sense to do a SQL dump -- 'man
> mysqldump'
If you can tolerate a few seconds of having your database offline, the
fastest and easiest way to get a coherent snapshot is to keep
/var/lib/mysql on its own LVM partition with extra unallocated extents
and take an LVM snapshot with the database shutdown for just a few
seconds. Something like the following:

/bin/mkdir /mnt/mysql-snapshot
/sbin/service mysql stop
/usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
/sbin/service mysql start
/bin/mount -r /dev/mysql/data /mnt/mysql-snapshot
/usr/bin/rsync -Saq --delete /mnt/mysql-snapshot /var/lib/mysql-backup/
/bin/umount /mnt/mysql-snapshot
/usr/sbin/lvremove -f /dev/mysql/data

Now you have a static and coherent snapshot of the database that can be
used for restoration just by copying it into /var/lib/mysql and that is
safe to be backed up by ordinary backup software. And the total time
offline for the backup is typically on the order ~10 seconds. If you do
it at 2AM no one is likely to even notice that you that you went offline
for 10 seconds or so.

--
Benjamin Franz

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Ross Walker 02-24-2010 12:03 AM

What to backup?
 
On Feb 23, 2010, at 7:29 PM, Benjamin Franz <jfranz@freerun.com> wrote:

> Robert Heller wrote:
>> What *I'd* do, is have separate partitions for /, /var /opt and /
>> home.
>> And do a monthy full dump of each file system, weekly incremental
>> dumps
>> of /var and /opt, and daily or every other day incremental dumps of
>> /home. It is probably iffy to get a meaningful dump of mysql's
>> running
>> database. It probably makes better sense to do a SQL dump -- 'man
>> mysqldump'
> If you can tolerate a few seconds of having your database offline, the
> fastest and easiest way to get a coherent snapshot is to keep
> /var/lib/mysql on its own LVM partition with extra unallocated extents
> and take an LVM snapshot with the database shutdown for just a few
> seconds. Something like the following:
>
> /bin/mkdir /mnt/mysql-snapshot
> /sbin/service mysql stop
> /usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
> /sbin/service mysql start
> /bin/mount -r /dev/mysql/data /mnt/mysql-snapshot
> /usr/bin/rsync -Saq --delete /mnt/mysql-snapshot /var/lib/mysql-
> backup/
> /bin/umount /mnt/mysql-snapshot
> /usr/sbin/lvremove -f /dev/mysql/data
>
> Now you have a static and coherent snapshot of the database that can
> be
> used for restoration just by copying it into /var/lib/mysql and that
> is
> safe to be backed up by ordinary backup software. And the total time
> offline for the backup is typically on the order ~10 seconds. If you
> do
> it at 2AM no one is likely to even notice that you that you went
> offline
> for 10 seconds or so.

Or a replica mysql database and use either mysqldump or lvm without
having to take the master down or interrupt it's activities.

-Ross

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Benjamin Franz 02-24-2010 12:04 AM

What to backup?
 
Benjamin Franz wrote:
> Something like the following:
>
> /bin/mkdir /mnt/mysql-snapshot
> /sbin/service mysql stop
> /usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
> /sbin/service mysql start
> /bin/mount -r /dev/mysql/data /mnt/mysql-snapshot
> /usr/bin/rsync -Saq --delete /mnt/mysql-snapshot /var/lib/mysql-backup/
> /bin/umount /mnt/mysql-snapshot
> /usr/sbin/lvremove -f /dev/mysql/data
>
Whups. I made a serious error with the LVM volumes above. You would end
up removing your database partition. Not good.

It should read like this:

/bin/mkdir /mnt/mysql-snapshot
/sbin/service mysql stop
/usr/sbin/lvcreate --permission r -L16G -s -n dbbackup /dev/mysql/data
/sbin/service mysql start
/bin/mount -r /dev/mysql/dbbackup /mnt/mysql-snapshot
/usr/bin/rsync -Saq --delete /mnt/mysql-snapshot/ /var/lib/mysql-backup/
/bin/umount /mnt/mysql-snapshot
/usr/sbin/lvremove -f /dev/mysql/dbbackup

--
Benjamin Franz

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Benjamin Franz 02-24-2010 12:06 AM

What to backup?
 
Ross Walker wrote:
> Or a replica mysql database and use either mysqldump or lvm without
> having to take the master down or interrupt it's activities.
>

That works well as long as your replication setup doesn't mysteriously
break. I've had issues with the 5.x replication spontaneously breaking
silently. YMMV.

--
Benjamin Franz

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Ross Walker 02-24-2010 12:39 AM

What to backup?
 
On Feb 23, 2010, at 8:06 PM, Benjamin Franz <jfranz@freerun.com> wrote:

> Ross Walker wrote:
>> Or a replica mysql database and use either mysqldump or lvm without
>> having to take the master down or interrupt it's activities.
>>
>
> That works well as long as your replication setup doesn't mysteriously
> break. I've had issues with the 5.x replication spontaneously breaking
> silently. YMMV.

Well make sure to setup a non-broken replica...

:-)

-Ross

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


All times are GMT. The time now is 04:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.