Re: PITR - base backup question

From: <steve(at)outtalimits(dot)com(dot)au>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: PITR - base backup question
Date: 2008-08-27 00:19:42
Message-ID: d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hi Richard,

This means a file systems backup. eg.

tar -cvpf data_bakup.tar /var/lib/pgsql/data

Here's a script I use to automate this process. It may be helpful to
customize for yourself.

#!/bin/bash
#
# PostgreSQL Weekly Backup
#

DATE=$(date +%G%m%d)
MAILLOG="/backup/weekly_$DATE.log"
WALARCH="/pgbackup"
DESTINATION="X.X.X.X::rsyncshare/"
EMAILDEST=""

touch $MAILLOG
echo -e "::::::::::::::: $DATE Pallas1 Weekly WAL Backup :::::::::::::::"
>> $MAILLOG

psql -U postgres -c "select pg_start_backup ('$DATE');"

cd /var/lib/pgsql
tar -cvpzf "pgbackup_$DATE.tar.gz" data/ >> $MAILLOG 2>&1

psql -U postgres -c "select pg_stop_backup ();"

find $WALARCH -perm 600 -mmin "+360" -exec rm {} \; >> $MAILLOG 2>&1
find $WALARCH/data_dir_backup -mtime "+5" -exec rm {} \; >> $MAILLOG 2>&1

ls -la $WALARCH >> $MAILLOG 2>&1

mv /var/lib/pgsql/pgbackup_$DATE.tar.gz /$WALARCH/data_dir_backup/.

rsync -a -v -v --progress --stats --delete "/$WALARCH" $DESTINATION >>
$MAILLOG 2>&1

/bin/cat $MAILLOG | mail -s "Weekly WAL Backup - Successful" $EMAILDEST &&
rm $MAILLOG

On Tue, 26 Aug 2008 15:53:33 -0700, "Richard Broersma"
<richard(dot)broersma(at)gmail(dot)com> wrote:
> From the following link:
>
http://www.postgresql.org/docs/8.3/interactive/continuous-archiving.html#BACKUP-BASE-BACKUP
>
> Step 3 says to perform the back up.
>
> Does this mean a File System Backup of the Data directory?
> OR
> Does this mean performing a pg_dumpall and backing up the dump file?
>
> --
> Regards,
> Richard Broersma Jr.
>
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug
>
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Merlin Moncure 2008-08-27 00:38:01 Re: [GENERAL] PITR - base backup question
Previous Message Tom Lane 2008-08-26 23:48:55 Re: vacuum verbose relations reporting

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2008-08-27 00:38:01 Re: [GENERAL] PITR - base backup question
Previous Message Guy Rouillier 2008-08-26 23:39:08 Re: SQL Question - "Recursion"