pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rafael Martinez <r.m.guerrero@usit.uio.no>
To: Steve Burrows <steve@jla.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Backing up large databases
Date: Fri, 28 Apr 2006 23:56:18 +0200
Message-ID: <1146261379.21793.38.camel@linux.site> (raw)
In-Reply-To: <44523B85.4020605@jla.com>
References: <44523B85.4020605@jla.com>

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.m.guerrero@usit.uio.no>
Center for Information Technology Services
University of Oslo, Norway

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




view thread (10+ messages)  latest in thread

Message-ID: <1146261379.21793.38.camel@linux.site>
Permalink:  ../1146261379.21793.38.camel@linux.site/
Also on:    postgresql.org/message-id/1146261379.21793.38.camel@linux.site

 · 

reply

Reply instructions:

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

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: r.m.guerrero@usit.uio.no, steve@jla.com
  Subject: Re: Backing up large databases
  In-Reply-To: <1146261379.21793.38.camel@linux.site>
  References: <44523B85.4020605@jla.com> <1146261379.21793.38.camel@linux.site>

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

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox