Re: pg_basebackup on slave running for a long time

From: Subhankar Chattopadhyay <subho(dot)atg(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_basebackup on slave running for a long time
Date: 2016-11-21 07:00:45
Message-ID: CAPg1NnGmAjbWOr+g_XmvsgtxzMOOm0vaT+1bS3jW-ed3xNAvmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yes so if the slave is behind I need to start over pgbasebackup. I saw
according to the documentation this query gives us the replication state.
Can somebody tell me if this would be sufficient to know if I need to start
over the backup ?

On 21 Nov 2016 12:18, "John R Pierce" <pierce(at)hogranch(dot)com> wrote:

> On 11/20/2016 10:37 PM, Subhankar Chattopadhyay wrote:
>
>> We are using the database in a cloud setup and the nodes are running
>> in VMs. The slave can fall behind for various reasons as you have
>> stated, like slave is shut down or high write workload.
>>
>> We don't use replication slot but the wal_keep_segments is high enough
>> for us, 5000 to be exact.
>>
>> In that case, we can do pg_basebackup only when necessary, like only
>> when slave is behind. We can check that from the query "SELECT state
>> FROM pg_stat_replication WHERE pid <> pg_backend_pid();" Will that be
>> correct way to do it?
>>
>
> maintaining a wal archive, and configuring the slaves so they can recover
> from it when they are restarted will likely take care of things if they are
> getting so far behind that 5000 wal segments is insufficient..
>
> I'm not that familiar with pg_stat_replication, I'm not sure what that
> query is telling you. others can probably chime in with more info on this.
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2016-11-21 07:10:28 Re: pg_basebackup on slave running for a long time
Previous Message John R Pierce 2016-11-21 06:46:56 Re: pg_basebackup on slave running for a long time