pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Seeking information about backup/recovery
6+ messages / 3 participants
[nested] [flat]

* Seeking information about backup/recovery
@ 2003-09-04 15:35 Mary Edie Meredith <maryedie@osdl.org>
  2003-09-04 18:15 ` Re: Seeking information about backup/recovery Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Mary Edie Meredith @ 2003-09-04 15:35 UTC (permalink / raw)
  To: pgsql-admin; +Cc: osdldbt-general <osdldbt-general@lists.sourceforge.net>

Dear PostgreSQL admin'ers,


Our group at OSDL have been  porting our DBT test kits to PostgreSQL.  
In getting up to speed on PostgreSQL, we have not found a way to recover
from a serious database failure (disk corruption, disk/volume failure).

The following scenario described in the 7.3 docs and the "PostgreSQL
7.4devel Documentation" is exactly what we are looking for:


"WAL offers the opportunity for a new method for database on-line backup
and restore (BAR). To use this method, one would have to make periodic
saves of data files to another disk, a tape or another host and also
archive the WAL log files. The database file copy and the archived log
files could be used to restore just as if one were restoring after a
crash. Each time a new database file copy was made the old log files
could be removed. Implementing this facility will require the logging of
data file and index creation and deletion; it will also require
development of a method for copying the data files (operating system
copy commands are not suitable). "

Since it states that WAL, "offers the opportunity" for what we need, we
concluded this is _not supported at 7.3 and the 7.4 beta releases.

Is this conclusion correct?

Of course we would like to do even more - point in time recovery,
incremental backup, but for now just the basics.

Point in Time recovery is listed as "Urgent" on the TODO list,
incremental backups are listed under "Admin", so it appears that those
items are recognized as important.  What we cannot understand is why the
basic backup/restore described above is not on the TODO list.

Can anyone enlighten us? 



-- 
Mary Edie Meredith <maryedie@osdl.org>
Open Source Development Lab




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Seeking information about backup/recovery
  2003-09-04 15:35 Seeking information about backup/recovery Mary Edie Meredith <maryedie@osdl.org>
@ 2003-09-04 18:15 ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2003-09-04 18:15 UTC (permalink / raw)
  To: Mary Edie Meredith <maryedie@osdl.org>; +Cc: pgsql-admin@postgresql.org, osdldbt-general <osdldbt-general@lists.sourceforge.net>


Right.  We need point-in-time-recovery.  Someone is working on it and we
hope to have it for 7.5.

---------------------------------------------------------------------------

Mary Edie Meredith wrote:
> Dear PostgreSQL admin'ers,
> 
> 
> Our group at OSDL have been  porting our DBT test kits to PostgreSQL.  
> In getting up to speed on PostgreSQL, we have not found a way to recover
> from a serious database failure (disk corruption, disk/volume failure).
> 
> The following scenario described in the 7.3 docs and the "PostgreSQL
> 7.4devel Documentation" is exactly what we are looking for:
> 
> 
> "WAL offers the opportunity for a new method for database on-line backup
> and restore (BAR). To use this method, one would have to make periodic
> saves of data files to another disk, a tape or another host and also
> archive the WAL log files. The database file copy and the archived log
> files could be used to restore just as if one were restoring after a
> crash. Each time a new database file copy was made the old log files
> could be removed. Implementing this facility will require the logging of
> data file and index creation and deletion; it will also require
> development of a method for copying the data files (operating system
> copy commands are not suitable). "
> 
> Since it states that WAL, "offers the opportunity" for what we need, we
> concluded this is _not supported at 7.3 and the 7.4 beta releases.
> 
> Is this conclusion correct?
> 
> Of course we would like to do even more - point in time recovery,
> incremental backup, but for now just the basics.
> 
> Point in Time recovery is listed as "Urgent" on the TODO list,
> incremental backups are listed under "Admin", so it appears that those
> items are recognized as important.  What we cannot understand is why the
> basic backup/restore described above is not on the TODO list.
> 
> Can anyone enlighten us? 
> 
> 
> 
> -- 
> Mary Edie Meredith <maryedie@osdl.org>
> Open Source Development Lab
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Seeking information about backup/recovery
@ 2003-09-04 21:34 Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
  2003-09-04 22:12 ` Re: Seeking information about backup/recovery Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Murthy Kambhampaty @ 2003-09-04 21:34 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; Mary Edie Meredith <maryedie@osdl.org>; +Cc: pgsql-admin@postgresql.org, osdldbt-general <osdldbt-general@lists.sourceforge.net>

IMHO, while point-in-time recovery would be great to have, there are many
applications that benefit from having online backup and recovery without
needing log roll-forward. For example, Oracle contrasts "Full Database
Point-in-time Recovery", the feature mentioned by Bruce, with "Tablespace
Point in Time Recovery (TSPITR)" [1]. With postgresql and WAL, you can
implement the equivalent of TSPITR. By using filesystem snapshot
capabilities provided by certain storage appliances (NetApp Filer?) or by
operating system service in Linux (Logical Volume Manager, "LVM") to "...
make periodic saves of data files to another disk, a tape or another host
and also archive the WAL log files". Once you have the copy, you can put it
on disk, start a postgresql server (call it the backup server) on it, and
then dump and restore the data to a running server ("production server") on
the same or a different host. 

This procedure allows you to recover a recent copy of any database, schema
or table, depending on the frequency with which you take snapshots. By using
rysnc to copy the snapshots over to a backup disk volume you can get
incremental backup capability, which shrinks the backup window to a few
minutes (and less than an hour even for databases with multiple gigabytes
worth of INSERTs). With such a small backup window, one can minimize data
loss in case of disk failure or corruption by increasing backup frequency.

There have been several discussions of this, including here
http://marc.theaimsgroup.com/?l=postgresql-admin&w=2&r=1&s=backup+routine&q=
b
here
http://marc.theaimsgroup.com/?l=postgresql-admin&w=2&r=1&s=LVM+snapshots&q=b
and here
http://marc.theaimsgroup.com/?l=postgresql-general&m=104610149723362&w=4


Cheers,
	Murthy


[1]
http://storacle.princeton.edu:9001/oracle8-doc/server.805/a58396/ch13.htm)


>-----Original Message-----
>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>Sent: Thursday, September 04, 2003 14:16
>To: Mary Edie Meredith
>Cc: pgsql-admin@postgresql.org; osdldbt-general
>Subject: Re: [ADMIN] Seeking information about backup/recovery
>
>
>
>Right.  We need point-in-time-recovery.  Someone is working on 
>it and we
>hope to have it for 7.5.
>
>---------------------------------------------------------------
>------------
>
>Mary Edie Meredith wrote:
>> Dear PostgreSQL admin'ers,
>> 
>> 
>> Our group at OSDL have been  porting our DBT test kits to 
>PostgreSQL.  
>> In getting up to speed on PostgreSQL, we have not found a 
>way to recover
>> from a serious database failure (disk corruption, 
>disk/volume failure).
>> 
>> The following scenario described in the 7.3 docs and the "PostgreSQL
>> 7.4devel Documentation" is exactly what we are looking for:
>> 
>> 
>> "WAL offers the opportunity for a new method for database 
>on-line backup
>> and restore (BAR). To use this method, one would have to 
>make periodic
>> saves of data files to another disk, a tape or another host and also
>> archive the WAL log files. The database file copy and the 
>archived log
>> files could be used to restore just as if one were restoring after a
>> crash. Each time a new database file copy was made the old log files
>> could be removed. Implementing this facility will require 
>the logging of
>> data file and index creation and deletion; it will also require
>> development of a method for copying the data files (operating system
>> copy commands are not suitable). "
>> 
>> Since it states that WAL, "offers the opportunity" for what 
>we need, we
>> concluded this is _not supported at 7.3 and the 7.4 beta releases.
>> 
>> Is this conclusion correct?
>> 
>> Of course we would like to do even more - point in time recovery,
>> incremental backup, but for now just the basics.
>> 
>> Point in Time recovery is listed as "Urgent" on the TODO list,
>> incremental backups are listed under "Admin", so it appears 
>that those
>> items are recognized as important.  What we cannot 
>understand is why the
>> basic backup/restore described above is not on the TODO list.
>> 
>> Can anyone enlighten us? 
>> 
>> 
>> 
>> -- 
>> Mary Edie Meredith <maryedie@osdl.org>
>> Open Source Development Lab
>> 
>> 
>> ---------------------------(end of 
>broadcast)---------------------------
>> TIP 7: don't forget to increase your free space map settings
>> 
>
>-- 
>  Bruce Momjian                        |  http://candle.pha.pa.us
>  pgman@candle.pha.pa.us               |  (610) 359-1001
>  +  If your life is a hard drive,     |  13 Roberts Road
>  +  Christ can be your backup.        |  Newtown Square, 
>Pennsylvania 19073
>
>---------------------------(end of 
>broadcast)---------------------------
>TIP 9: the planner will ignore your desire to choose an index 
>scan if your
>      joining column's datatypes do not match
>



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Seeking information about backup/recovery
  2003-09-04 21:34 Re: Seeking information about backup/recovery Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
@ 2003-09-04 22:12 ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2003-09-04 22:12 UTC (permalink / raw)
  To: Murthy Kambhampaty <murthy.kambhampaty@goeci.com>; +Cc: Mary Edie Meredith <maryedie@osdl.org>; pgsql-admin@postgresql.org, osdldbt-general <osdldbt-general@lists.sourceforge.net>

Murthy Kambhampaty wrote:
> IMHO, while point-in-time recovery would be great to have, there are many
> applications that benefit from having online backup and recovery without
> needing log roll-forward. For example, Oracle contrasts "Full Database
> Point-in-time Recovery", the feature mentioned by Bruce, with "Tablespace
> Point in Time Recovery (TSPITR)" [1]. With postgresql and WAL, you can
> implement the equivalent of TSPITR. By using filesystem snapshot
> capabilities provided by certain storage appliances (NetApp Filer?) or by
> operating system service in Linux (Logical Volume Manager, "LVM") to "...
> make periodic saves of data files to another disk, a tape or another host
> and also archive the WAL log files". Once you have the copy, you can put it
> on disk, start a postgresql server (call it the backup server) on it, and
> then dump and restore the data to a running server ("production server") on
> the same or a different host. 
> 
> This procedure allows you to recover a recent copy of any database, schema
> or table, depending on the frequency with which you take snapshots. By using
> rysnc to copy the snapshots over to a backup disk volume you can get
> incremental backup capability, which shrinks the backup window to a few
> minutes (and less than an hour even for databases with multiple gigabytes
> worth of INSERTs). With such a small backup window, one can minimize data
> loss in case of disk failure or corruption by increasing backup frequency.

I assume you are contrasting _any_ point-in-time recovery to recover up
to the crash point, right?

Anyway, unfortunately, WAL doesn't contain enough information to recover
without having the file system files in some consistent state, even if
that state is old.  In fact, the files have to be consistent as of the
last checkpoint.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Seeking information about backup/recovery
@ 2003-09-04 23:29 Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
  2003-09-05 00:32 ` Re: Seeking information about backup/recovery Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Murthy Kambhampaty @ 2003-09-04 23:29 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Mary Edie Meredith <maryedie@osdl.org>; pgsql-admin@postgresql.org, osdldbt-general <osdldbt-general@lists.sourceforge.net>

On Thursday, September 04, 2003 18:12, Bruce Momjian
[mailto:pgman@candle.pha.pa.us]
>Murthy Kambhampaty wrote:
...
>I assume you are contrasting _any_ point-in-time recovery to recover up
>to the crash point, right?
>
Right.

>Anyway, unfortunately, WAL doesn't contain enough information 
>to recover
>without having the file system files in some consistent state, even if
>that state is old.  In fact, the files have to be consistent as of the
>last checkpoint.
This, I'm not so sure of. On Linux, an xfs_freeze -f <fs_to_freeze> pauses
the filesystem and flushes all writes to disk; a snapshot of $PGDATA's
filesystem taken while it is frozen gives a consistent copy of $PGDATA as of
that instant (similar functionality is obtained by compiling the VFS locking
patch into the kernel). 

The discussion at
http://marc.theaimsgroup.com/?l=postgresql-admin&w=2&r=1&s=LVM+snapshots&q=b
, includes log files from postmaster startup and shutdown on the backup
$PGDATA, and AFAICT, WAL recovery does not roll back to the last checkpoint.
If there is a better way to test this, let me know, and I'm happy to do it.

Thanks,
	Murthy

PS: From the man page for xfs_freeze:

"The -f flag requests the specified XFS filesystem to be frozen from new
modifications.   When this is selected, all ongoing transactions in the
filesystem are allowed to complete, new write system calls are  halted,
other calls which modify the filesystem are halted, and all dirty data,
metadata, and  log  information  are  written  to  disk.   Any  process
attempting to write to the frozen filesystem will block waiting for the
filesystem to be unfrozen."

When $PGDATA/pg_xlog/ is on disks different from $PGDATA's, 
the XFS filesystem still allows online BAR with the following sequence:

1. rysnc -avr --delete $PGDATA/ <backup server>::mirror_pgdata/
2. xfs_freeze -f $PGDATA/pg_clog/
3. xfs_freeze -f $PGDATA
4. create snapshots and mount
5. xfs_freeze -f $PGDATA
6. xfs_freeze -f $PGDATA/pg_clog/
7. rysnc -avr --delete --exclude=pg_xlog/ $PGDATA/ <backup
server>::mirror_pgdata/pg_xlog/
8. rysnc -avr --delete $PGDATA/pg_xlog/ $PGDATA/ <backup
server>::mirror_pgdata/pg_xlog/
9. remove snapshots

By freezing both volumes ($PGDATA/pg_clog/ and $PGDATA/) during snapshot
creation, 
a "consistent" copy is assured. Freezing the pg_xlog first, and unfreezing
it last, makes sure
that no CHECKPOINT operations are missed, ensuring the consistency of the
copy.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Seeking information about backup/recovery
  2003-09-04 23:29 Re: Seeking information about backup/recovery Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
@ 2003-09-05 00:32 ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2003-09-05 00:32 UTC (permalink / raw)
  To: Murthy Kambhampaty <murthy.kambhampaty@goeci.com>; +Cc: Mary Edie Meredith <maryedie@osdl.org>; pgsql-admin@postgresql.org, osdldbt-general <osdldbt-general@lists.sourceforge.net>

Murthy Kambhampaty wrote:
> >Anyway, unfortunately, WAL doesn't contain enough information 
> >to recover
> >without having the file system files in some consistent state, even if
> >that state is old.  In fact, the files have to be consistent as of the
> >last checkpoint.
> This, I'm not so sure of. On Linux, an xfs_freeze -f <fs_to_freeze> pauses
> the filesystem and flushes all writes to disk; a snapshot of $PGDATA's
> filesystem taken while it is frozen gives a consistent copy of $PGDATA as of
> that instant (similar functionality is obtained by compiling the VFS locking
> patch into the kernel). 
> 
> The discussion at
> http://marc.theaimsgroup.com/?l=postgresql-admin&w=2&r=1&s=LVM+snapshots&q=b
> , includes log files from postmaster startup and shutdown on the backup
> $PGDATA, and AFAICT, WAL recovery does not roll back to the last checkpoint.
> If there is a better way to test this, let me know, and I'm happy to do it.

Yes, this has been discussed before.  If you snapshot xfs, you can then
restore using that snapshot.  Of course, you will be recovering from WAL
as though there was a crash, but that works fine.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2003-09-05 00:32 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04 15:35 Seeking information about backup/recovery Mary Edie Meredith <maryedie@osdl.org>
2003-09-04 18:15 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-09-04 21:34 Re: Seeking information about backup/recovery Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
2003-09-04 22:12 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-09-04 23:29 Re: Seeking information about backup/recovery Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
2003-09-05 00:32 ` Bruce Momjian <pgman@candle.pha.pa.us>

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