Re: Turning slave into a master - PostgreSQL 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Turning slave into a master - PostgreSQL 9.2
Date: 2016-10-31 22:59:55
Message-ID: CAJNY3iu2GNVPQ14RNzL2SNyEf0iQO9xZKcBwYQ+-gsvjJV5eyw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-11-01 10:33 GMT+13:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Mon, Oct 31, 2016 at 1:46 PM, Patrick B <patrickbakerbr(at)gmail(dot)com>
> wrote:
>
>> Hi guys,
>>
>> I got a test server, let's call it test01.
>>
>> The test01 has a basebackup from the master.
>> I want to turn test01 into a master. It doesn't need to catch up with the
>> wal_files, because I don't need it to be up-to-date.
>>
>> So what I did is:
>>
>> - Replaced /var/lib/pgsql/9.2/data/ with the basebackup
>> - Created recovery.conf:
>>
>> restore_command = 'cp /var/lib/pgsql/wal_archive/%f %p'
>>
>> recovery_target_timeline = 'latest'
>>
>> standby_mode = off
>>
>> trigger_file = '/tmp/pg_failover_trigger'
>>
>> - touch /tmp/pg_failover_trigger
>> - service postgresql start
>>
>> And then postgres starts recovering the wal_files. But I don't want
>> that.. as I don't need a up-to-date
>>
>> Is the wal_files required anyway?
>>
>>
> ​"...has a basebackup from the master" - the answer to your question
> depends greatly on the detail behind that sentence.
>
> IIRC, unless you know that the data directory is consistent - because the
> database was offline at the time of the backup - at least some WAL will
> probably be required to bring the inconsistent backup data directory to a
> known good state (i.e., post-checkpoint).
>
> David J.
> ​
> ​
>
>

I see...

as I'm recovering a slave and then turning it into a master, that's why the
wal_files are required.

Thanks!
Patrick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-10-31 23:25:56 Re: Way to quickly detect if database tables/columns/etc. were modified?
Previous Message David G. Johnston 2016-10-31 21:33:18 Re: Turning slave into a master - PostgreSQL 9.2