From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Using cp to back up a database? |
Date: | 2017-10-09 16:33:27 |
Message-ID: | CAMkU=1wDdONsLbtkNR=zQkBgZaVJGvVwu7D2Uc+L+HJRhgy8WA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Oct 9, 2017 at 6:40 AM, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> wrote:
> Hi,
>
> v8.4.20
>
> This is what the current backup script uses:
>
> /usr/bin/psql -U postgres -c "SELECT pg_start_backup('
> Incrementalbackup',true);"
> cp -r /var/lib/pgsql/data/* $dumpdir/data/
> /usr/bin/psql -U postgres template1 -c "SELECT pg_stop_backup();"
>
>
That's fine, as long as you have a wal archive. Although I don't know what
is "Incremental" about it. If you upgrade to a version which wasn't quite
so ancient, you could use pg_basebackup.
>
> Should it use rsync or pg_dump instead?
>
rsync is dangerous if not used with great care, and probably isn't going to
get you much for just doing a backup.
pg_dump is also fine, but it does something different, it creates a logical
backup, not a physical backup. The backup from pg_dump cannot be used to
seed a PITR or streaming replica. On the other hand, it can restored into
a database from a different version and different architecture. And with
pg_dump the pg_start_backup and pg_stop_backup are useless and confusing.
Cheers
From | Date | Subject | |
---|---|---|---|
Next Message | mj0nes | 2017-10-09 16:33:29 | pg_start/stop_backup naming conventions |
Previous Message | Achilleas Mantzios | 2017-10-09 14:20:36 | Re: Using cp to back up a database? |