Re: Looking for a script that performs full online backup of postgres in archive mode

From: Chris Barnes <compuguruchrisbarnes(at)hotmail(dot)com>
To: <postgres(at)lambic(dot)co(dot)uk>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Looking for a script that performs full online backup of postgres in archive mode
Date: 2009-11-09 16:04:24
Message-ID: BLU149-W44E8BE921160DBA1F913C2D4AC0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


That gives me an idea what others are doing.

Thank you Mark, : )

> Date: Mon, 9 Nov 2009 09:24:28 -0500
> From: postgres(at)lambic(dot)co(dot)uk
> To: compuguruchrisbarnes(at)hotmail(dot)com
> CC: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Looking for a script that performs full online backup of postgres in archive mode
>
> On Mon, Nov 09, 2009 at 09:15:03AM -0500, Chris Barnes wrote:
> > Would anyone in the postgres community have a shell script that
> > performs a full online backup of postgres?
>
> Here's roughly what we do:
>
> REMOTE="foo"
> DATA="/srv/pgdata"
> WAL="/var/lib/pgsql/wal-archive"
> PSQL="/usr/bin/psql"
> RSYNC="/usr/bin/rsync -e ssh -qxat --delete"
>
> if [ "$1" == "data" ]; then
> # Do full backup of data directory
> ${PSQL} -c "SELECT pg_start_backup('mirror');" >/dev/null
> ${RSYNC} ${DATA} ${REMOTE}/${DATA}
> ${PSQL} -c "SELECT pg_stop_backup();" >/dev/null
>
> elif [ "$1" == "wal" ]; then
> # Just copy the latest write-ahead logs
> ${RSYNC} ${WAL} ${REMOTE}/${WAL}
> ${RSYNC} ${DATA}/pg_xlog/ ${REMOTE}/${DATA}/pg_xlog
>
> else
> # Don't know what you want
> echo "Usage: $0 [data|wal]"
> exit 1
> fi
>
> --
> Mark
> http://www.lambic.co.uk
>

_________________________________________________________________
Eligible CDN College & University students can upgrade to Windows 7 before Jan 3 for only $39.99. Upgrade now!
http://go.microsoft.com/?linkid=9691819

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yadira Lizama Mue 2009-11-09 16:13:51 Re: Execute a query passed by parameters to a function
Previous Message Thom Brown 2009-11-09 16:00:28 Re: Execute a query passed by parameters to a function