Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: extra step to comment out postgresql.conf data_directory

...

  1. Stop postgres, if it's running

    pg_ctl -D $PGDATA -m smart

     

  2. Restore the database files from base.tar.gz to $PGRESTORE

    gunzip base.tar.gz 
    tar -xvf base.tar --directory $PGRESTORE
  3. Duplicate the permissions from PGDATA to PGRESTORE,  including file owner and file permissions, for example

    chmod 700 $PGRESTORE
    find $PGRESTORE | xargs chown postgres:daemon

     

  4. Copy configuration files from $PGDATA (e.g. $PGDATE/*.conf) to $PGRESTORE.
  5. (Important!) comment out the following properties from $PGRESTORE/postgresql.conf
    1. "data_directory"
    2. "hba_file"
    3. "ident_file"
    4. "external_pid_file"
  6. Add a recovery.conf file to $PGDATA$PGRESTORE.  At the very least this should include a 'restore_command' entry (see previous section).
  7. Start postgres

    pg_ctl -D $PGRESTORE start

...