Re: pg_basebackup on standby node failed

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Ying He <yinghe0101(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_basebackup on standby node failed
Date: 2014-02-01 01:00:47
Message-ID: CAB7nPqTQ7KkijePPtXjGQ65QunKx_KQfc03AzBnO5+4bLSbObQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Feb 1, 2014 at 7:07 AM, Ying He <yinghe0101(at)yahoo(dot)com> wrote:
> hi, All,
>
> I intend to do a basebackup on a hot standby node. I followed the
> instructions on
> http://www.postgresql.org/docs/9.2/static/app-pgbasebackup.html to turn
> full_page_writes on at master and other settings on standby.
>
> When I try to select pg_start_backup('backuplabel'); on the standby
> instance, it give me the following:
> ERROR: recovery is in progress
> HINT: WAL control functions cannot be executed during recovery.
>
> I tried select pg_xlog_replay_pause(); before the select
> pg_start_backup('backuplabel'); but that does not help.
>
> Also why select pg_is_in_recovery(); always returns true when select
> pg_is_xlog_replay_paused(); is true? I thought when I do select
> pg_xlog_replay_pause(); the standby should not be in recovery
>
> Please help if you know anything about this. Thank you.
Taking a backup with pg_basebackup and with pg_start/stop_backup are
two different things on a standby. In short, you are not allowed to
run pg_start/stop_backup in recovery on a standby because
pg_stop_backup needs to write a WAL record called XLOG_BACKUP_END once
it is done. Only pg_basebackup is able to take backups from a standby
because it uses the replication protocol to take the backup and
bypasses the WAL record by waiting that all the needed WAL files have
been archived.
So use pg_basebackup for a standby :)

Regards,
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vik Fearing 2014-02-01 01:25:16 Re: [GENERAL] Insert result does not match record count
Previous Message Tom Lane 2014-01-31 23:00:05 Re: [GENERAL] Possible bug with row_to_json