pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: steve@outtalimits.com.au
To: Richard Broersma <richard.broersma@gmail.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: PITR - base backup question
Date: Wed, 27 Aug 2008 10:19:42 +1000
Message-ID: <d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1> (raw)
In-Reply-To: <396486430808261553k6687500q19f4117b6c71ae3f@mail.gmail.com>
References: <396486430808261553k6687500q19f4117b6c71ae3f@mail.gmail.com>

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.broersma@gmail.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
> 
>



view thread (12+ messages)  latest in thread

Message-ID: <d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1>
Permalink:  ../d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1/
Also on:    postgresql.org/message-id/d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: steve@outtalimits.com.au, richard.broersma@gmail.com, pgsql-general@postgresql.org
  Subject: Re: PITR - base backup question
  In-Reply-To: <d6f7e57b72cad11a6c2578624d0fad87@127.0.0.1>

* 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