PITR Doc clarifications

Поиск
Список
Период
Сортировка
Искать

PITR Doc clarifications

От:
Simon Riggs <simon@2ndquadrant.com>
Дата:

A few docs changes, as mentioned.

Comments?

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com

Re: PITR Doc clarifications

От:
Alvaro Herrera <alvherre@alvh.no-ip.org>
Дата:
Simon Riggs wrote:
> 
> A few docs changes, as mentioned.
> 
> Comments?

You forgot the patch :-)

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)

Re: PITR Doc clarifications

От:
Simon Riggs <simon@2ndquadrant.com>
Дата:
Вложения:
On Wed, 2007-11-28 at 10:12 -0300, Alvaro Herrera wrote:
> Simon Riggs wrote:
> > 
> > A few docs changes, as mentioned.
> > 
> > Comments?
> 
> You forgot the patch :-)

No, just a very short patch. :-)

This patch is slightly longer...

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com

Re: PITR Doc clarifications

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Simon Riggs wrote:
> On Wed, 2007-11-28 at 10:12 -0300, Alvaro Herrera wrote:
> > Simon Riggs wrote:
> > > 
> > > A few docs changes, as mentioned.
> > > 
> > > Comments?
> > 
> > You forgot the patch :-)
> 
> No, just a very short patch. :-)
> 
> This patch is slightly longer...

Slightly modified patch attached and applied.  Thanks.

-- 
  Bruce Momjian          http://momjian.us
  EnterpriseDB                             http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/backup.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v
retrieving revision 2.108
diff -c -c -r2.108 backup.sgml
*** doc/src/sgml/backup.sgml	28 Nov 2007 15:42:30 -0000	2.108
--- doc/src/sgml/backup.sgml	28 Nov 2007 22:34:06 -0000
***************
*** 641,650 ****
     
      Also, you can force a segment switch manually with
      pg_switch_xlog</>, if you want to ensure that a
!     just-finished transaction is archived immediately.  Other utility
      functions related to WAL management are listed in .
     
    
  
    
--- 641,662 ----
     
      Also, you can force a segment switch manually with
      pg_switch_xlog</>, if you want to ensure that a
!     just-finished transaction is archived as soon as possible.  Other utility
      functions related to WAL management are listed in .
     
+ 
+    
+     When archive_mode</> is off</> some SQL commands
+     are optimized to avoid WAL logging, as described in . If archiving were turned on during execution
+     of one of these statements, WAL would not contain enough information
+     for archive recovery.  (Crash recovery is unaffected.)  For
+     this reason, archive_mode</> can only be changed at server
+     start.  (archive_command</> can be changed with a
+     configuration file reload, and setting it to ''</> does
+     prevent archiving.)
+    
    
  
    
***************
*** 973,986 ****
     
      Normally, recovery will proceed through all available WAL segments,
      thereby restoring the database to the current point in time (or as
!     close as we can get given the available WAL segments).  But if you want
!     to recover to some previous point in time (say, right before the junior
!     DBA dropped your main transaction table), just specify the required
!     stopping point in recovery.conf</>.  You can specify the stop
!     point, known as the recovery target</>, either by date/time or
!     by completion of a specific transaction ID.  As of this writing only
!     the date/time option is very usable, since there are no tools to help
!     you identify with any accuracy which transaction ID to use.
     
  
     
--- 985,1008 ----
     
      Normally, recovery will proceed through all available WAL segments,
      thereby restoring the database to the current point in time (or as
!     close as we can get given the available WAL segments).  So a normal
!     recovery will end with a "file not found" message, the exact text
!     of the error message depending upon your choice of 
!     restore_command</>.  You may also see an error message
!     at the start of recovery for a file named something like
!     00000001.history</>.  This is also normal and does not
!     indicate a problem in simple recovery situations. See 
!      for discussion.
!    
! 
!    
!     If you want to recover to some previous point in time (say, right before
!     the junior DBA dropped your main transaction table), just specify the 
!     required stopping point in recovery.conf</>.  You can specify 
!     the stop point, known as the recovery target</>, either by 
!     date/time or by completion of a specific transaction ID.  As of this 
!     writing only the date/time option is very usable, since there are no tools 
!     to help you identify with any accuracy which transaction ID to use.
     
  
     
***************
*** 1214,1219 ****
--- 1236,1327 ----
     
    
  
+   
+    Tips and Examples
+ 
+    
+     Some examples of configuring Continuous Archiving are given here.
+    
+ 
+     
+      Recovery Settings
+ 
+      
+       It is possible to use the existing backup facilities to produce
+       standalone hot backups. These are backups that cannot be used for
+       point-in-time recovery, yet are much faster to backup and restore
+       than pg_dump</>.
+      
+ 
+      
+       To configure standalone backups you should use a switch file. If the
+       file exists then archives are made, otherwise archiving is ignored.
+ 
+ archive_command = 'test -f /var/lib/pgsql/backup_in_progress && cp -i %p /var/lib/pgsql/archive/%f </dev/null'
+ 
+       Backup can then be taken using a script like the following:
+ 
+ touch /var/lib/pgsql/backup_in_progress
+ psql -c "select pg_start_backup('hot_backup');"
+ tar -cvf /var/lib/pgsql/backup.tar /var/lib/pgsql/data/
+ psql -c "select pg_stop_backup();"
+ sleep 20
+ rm /var/lib/pgsql/backup_in_progress
+ tar -rvf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/
+ 
+       The switch file /var/lib/pgsql/backup_in_progress</> is
+       created first, allowing archiving to start prior to the backup.
+       After the backup the switch file is removed. Archived WAL files are
+       then added to the backup so that both base backup and all required
+       WAL files are part of the same tar</> file.
+      
+     
+ 
+     
+      <varname>archive_command</varname> scripts
+ 
+      
+       Many people choose to use scripts to define their 
+       archive_command, so that their
+       postgresql.conf</> looks very simple:
+ 
+ archive_command = 'local_backup_script.sh'
+ 
+       This allows all complexity to be managed within the script, which
+       can be written in a popular scripting language such as
+       bash</> or perl</>.  Statements echoed to
+       stderr</> will appear in the database server log, allowing
+       complex configurations to be easily diagnosed if they fail.
+      
+      
+       Example of how scripts might be used include:
+       
+        
+         
+          Copying data to a secure off-site data storage provider
+         
+        
+        
+         
+          Batching WAL files so they are transferred every three hours, rather than
+          one at a time as they fill
+         
+        
+        
+         
+          Interfacing with other backup and recovery software
+         
+        
+        
+         
+          Interfacing with monitoring software to report errors directly
+         
+        
+       
+      
+     
+   
+ 
    
     Caveats
  
***************
*** 1435,1441 ****
      Pseudocode for a suitable restore_command</> is:
  
  triggered = false;
! while (!NextWALFileReady() && !triggered)
  {
      sleep(100000L);         /* wait for ~0.1 sec */
      if (CheckForExternalTrigger())
--- 1543,1549 ----
      Pseudocode for a suitable restore_command</> is:
  
  triggered = false;
! while (!NextWALFileReady() && !triggered)
  {
      sleep(100000L);         /* wait for ~0.1 sec */
      if (CheckForExternalTrigger())

Re: PITR Doc clarifications

От:
Simon Riggs <simon@2ndquadrant.com>
Дата:
On Wed, 2007-11-28 at 17:36 -0500, Bruce Momjian wrote:

> Slightly modified patch attached and applied.  Thanks.

Nice additions, thanks.

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com

FAQ