Re: Backing up large databases

From: Rafael Martinez <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
To: Steve Burrows <steve(at)jla(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Backing up large databases
Date: 2006-04-28 21:56:18
Message-ID: 1146261379.21793.38.camel@linux.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, 2006-04-28 at 15:57 +0000, Steve Burrows wrote:

>
> Anybody with any ideas? The database is being used as the backend for
> a mail server, so it has transactions 24 hours a day but is quieter at
> night. I want to be able to back it up or replicate it on a daily
> basis with minimum downtime so that the mail backlog doesn't get too
> large. Ideally I want the first generation of backup/replica going
> onto the same machine as the original because the volume of data is
> such that any attempt at network or tape backup of the live files will
> require too much downtime, once I've got a backup then I can copy that
> out to other NAS or tape at leisure.
>

What about LVM2 snapshot functionality?.

We use snapshot to get a replica of the data partition for PITR purposes
(I have not tested this outside the PITR system).

To be 100% sure that the snapshot of the database is 100% consistent you
can:
1) stop the database
2) take the snapshot
3) start the database
4) mount the snapshot block device created
5) move the data in the snapshot block device (consistent copy of your
database) to another location outside the server without having downtime
in your database.
6) umount snapshot block device
7) remove snapshot block device (so you can recycle the space used)

A snapshot of a 25GB logical volume (with a 15GB database) takes 0.4sec
in our system (RHEL AS4/amd64linux), I don't think it will take much
longer with a 180GB LV, we are talking about a few seconds downtime.

Just an idea :)

More information about LVM:
http://www.tldp.org/HOWTO/LVM-HOWTO/
http://www.tldp.org/HOWTO/LVM-HOWTO/snapshotintro.html
http://www.tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html

with regards
--
Rafael Martinez, <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
Center for Information Technology Services
University of Oslo, Norway

PGP Public Key: http://folk.uio.no/rafael/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message alex.cotarlan 2006-04-28 22:46:30 Re: Backing up large databases
Previous Message Warren Little 2006-04-28 20:17:08 Re: questions on toast tables