public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Steve Dommett <steve@st4vs.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Backups
Date: Sun, 30 Sep 2007 22:40:37 +0100	[thread overview]
Message-ID: <200709302240.38468.steve@st4vs.net> (raw)
In-Reply-To: <20070930201504.572d8094@krikkit.digimed.co.uk>

On Sunday 30 September 2007, Neil Bothwick wrote:
> Other data in /var/lib. For example, any databases kept in /var/lib/mysql.

Rather than backup MySQL's or Postgres' binary storage I prefer to use the 
relevant tool (mysqldump, pgdump[all]) to backup the database 
to /root/backups/ just prior to running the real backup job.  This has the 
advantage that you can generally restore onto any version of the database 
server, rather than the specific version that was running when the backup was 
taken.

I'm not 100% sure but I thought this method of dumping the database is the 
only way to guarantee consistency of the snapshot without having to stop the 
database server for the duration of the backup.  From what I understand when 
backing up a live database Postgres guarantees the consistency using MVCC but 
MySQL may be a little less careful if INSERTs/UPDATEs happen during the 
backup.  For keeping a hot-spare failover database server closely in sync 
with realtime changes I'd suggest Slony1.

Unless the database contains blobs I prefer to dump as plain text INSERTs and 
compress using gzip patched with --rsyncable support which leads me to...

After backing up the database I /always/ backup to a remote machine,  
sometimes two, using rdiff-backup.  It does point-in-time recovery and 
supports ACLs and xattr.  The backup is not in some odd file format; it's 
stored in a subfolder of your filesystem just like any other tree of files so 
it is instantly available.  A subfolder called rdiff-backup-data stores all 
the rollbacks and also all the acl/xattr/other metadata so the destination 
filesystem doesn't need to support them. There was even a GSoC project to 
provide a FUSE interface to mount the backup folder as it appeared at the 
time of some previous backup.  This is all /very/ nice for when used in 
combination with Linux-VServer.  With a little thought about XIDs you can 
start a backed-up VServer on your development box ;-)

This is the essence of what I run in a cron job on the machine needing to be 
backed up:
#!/bin/bash

#/root/backup_mysql.sh
#/root/backup_postgres.sh

mount /boot > /dev/null 2> /dev/null

rdiff-backup --force --remove-older-than 90d  \
 backups@backuphost::~/backups/myhostname/

echo "--------------------"

time rdiff-backup   \
 -v2 --print-statistics \
  --exclude /mnt \
  --exclude /media \
  --exclude /dev \
  --exclude /proc \
  --exclude /tmp \
  --exclude /var/tmp \
  --exclude /var/cache/squid/ \
  --exclude /var/cache/http-replicator/ \
  --exclude /var/lib/mysql/ \
  --exclude /var/lib/postgresql/data/base/ \
  --exclude /var/lib/postgresql/data/global/ \
  --exclude /var/lib/postgresql/data/pg_clog/ \
  --exclude /var/lib/postgresql/data/pg_subtrans/ \
  --exclude /var/lib/postgresql/data/pg_tblspc/ \
  --exclude /var/lib/postgresql/data/pg_xlog/ \
  --exclude /sys/ \
  --exclude /usr/portage/ \
  --exclude /usr/portage/distfiles \
 / backups@backuphost::~/backups/myhostname/

umount /boot > /dev/null 2> /dev/null
-- 
gentoo-user@gentoo.org mailing list



  reply	other threads:[~2007-09-30 21:58 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-29 22:26 [gentoo-user] Backups Grant
2007-09-29 23:06 ` Volker Armin Hemmann
2007-09-29 23:28   ` Grant
2007-09-30  1:22     ` Volker Armin Hemmann
2007-09-30  1:35     ` Kenneth Prugh
2007-10-01  0:50       ` Dan Farrell
2007-10-03 13:15     ` Matthias Bethke
2007-09-29 23:45   ` Grant
2007-09-30  1:24     ` Volker Armin Hemmann
2007-09-30  3:44     ` Mark Shields
2007-09-30 15:37       ` Grant
2007-10-05 15:16     ` Joost Roeleveld
2007-09-30  7:17   ` Alan McKinnon
2007-09-30  0:08 ` Albert Hopkins
2007-09-30  3:38 ` Steen Eugen Poulsen
2007-09-30 10:41   ` Florian Philipp
2007-09-30 15:36   ` Grant
2007-09-30 15:50     ` Grant
2007-09-30 16:14       ` Dale
     [not found]         ` <49bf44f10709300931q5f5cdd29x304755a624e71945@mail.gmail.com>
2007-09-30 20:16           ` Jerry McBride
2007-09-30 22:02             ` Neil Bothwick
2007-09-30 22:20               ` Jerry McBride
2007-09-30 22:50                 ` Neil Bothwick
2007-09-30 19:14       ` Neil Bothwick
2007-09-30 16:33     ` Grant
2007-09-30 16:51       ` Florian Philipp
2007-09-30 17:37         ` Grant
2007-09-30 18:45           ` Alan McKinnon
2007-09-30 18:54             ` Grant
2007-09-30 18:35       ` Christopher Copeland
2007-09-30 18:46         ` Grant
2007-09-30 19:12       ` Neil Bothwick
2007-09-30 19:15     ` Neil Bothwick
2007-09-30 21:40       ` Steve Dommett [this message]
2007-10-01  1:03       ` Dan Farrell
2007-10-01  1:09 ` Dan Farrell
2007-10-01  2:15   ` Mark Kirkwood
2007-10-01 16:43     ` [gentoo-user] Backups Francesco Talamona
2007-10-01 20:16       ` Jason Messerschmitt
2007-10-02  0:27       ` Mark Kirkwood
2007-10-02 19:25         ` Francesco Talamona
2007-10-02 23:01           ` Mark Kirkwood
2007-10-03  5:21             ` Francesco Talamona
  -- strict thread matches above, loose matches on Subject: below --
2014-09-09 18:36 [gentoo-user] can not compile / emerge Joseph
2014-09-10  2:59 ` Kerin Millar
2014-09-10  3:21   ` Joseph
2014-09-10  3:27     ` Kerin Millar
2014-09-10  3:50       ` [gentoo-user] [SOLVED] " Joseph
2014-09-10  3:57         ` Kerin Millar
2014-09-10  4:16           ` Joseph
2014-09-10  5:01             ` Kerin Millar
2014-09-10  5:10               ` Kerin Millar
2014-09-10  5:32                 ` [gentoo-user] BACKUPS Joseph
2014-09-10  7:14                   ` Alan McKinnon
2014-09-10  7:47                     ` Dale
2014-09-10  7:51                       ` J. Roeleveld
2014-09-10  8:03                         ` Dale
2014-09-10  9:13                           ` Alan McKinnon
2014-09-10  8:34                     ` Neil Bothwick
2014-09-10 11:03                   ` Kerin Millar
2010-02-27 20:02 [gentoo-user] Backups BRM
2005-12-15 14:32 brettholcomb
2005-12-15 13:03 Allan Spagnol Comar
2005-12-15 16:53 ` Richard Fish
2005-12-15 17:27   ` John J. Foster
2005-12-15 19:15   ` Neil Bothwick
2005-12-15 20:04     ` Richard Fish
2005-12-15 20:26       ` Allan Spagnol Comar
2005-12-16 13:13         ` Paweł Madej
2005-12-16 15:20           ` Allan Spagnol Comar
2005-12-15 21:49       ` Neil Bothwick
2005-12-22 14:26     ` Michael Kintzios
2005-12-22 19:30       ` Neil Bothwick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709302240.38468.steve@st4vs.net \
    --to=steve@st4vs.net \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox