Обсуждение: Queries Regarding Postgresql Replication
Hi ,
I have some couple of queries while doing postgres replication,
===> How to find whether current postgres is running as master or slave?
====> What is the procedure to make the failed master as working slave?
Could you please clarify above queries.
Thanks and Regards
Nithya R
Lead Engineer| Tel-Pw-LTE| AMB-5
HCL Technologies | Chennai- 600 058
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
Вложения
On Thu, May 5, 2011 at 7:33 AM, Nithya Rajendran <r-nithya@hcl.com> wrote: [Disclaimer: I have minimal experience with hot standby, the below is just from reading the docs] > ===> How to find whether current postgres is running as master or slave? SELECT pg_is_in_recovery(); will tell you (should be false for the master, true for the slave). > ====> What is the procedure to make the failed master as working slave? You mean, after you've failed over from A to B, how to bring A back up as a slave of B? You should be able to just follow the steps of setting up a master-slave pair, with B as the new master, and A the new slave. Josh
*====> What is the procedure to make the failed master as working slave?* Check whether the following steps works for you... Assume the following is your use case., Master ----> Slave(Stand by..) Master replicating to slave. At time when master failed, the slave takes over as new master. Now your requirement to restart the failed master and reconfigure the same as standby for the new master. Stop the failed master. 1. Once the stand by taken over as master (once recovery.done and before any new data inserted...), copy file pg_control (available under data/global/) and the newly generated timeline history file available under archive folder (e-g., file like 00000002.history) 2. Remove all files under pg_xlog directory and in archive folder in the failed master . The above copied pg_control file, should be replaced in this failed master under data/global/). The above copied history should be copied in archive folder. Reconfigure the recovery.conf to point the new master Try starting the server..,(new standby) I hope it works ! - Senthil -- View this message in context: http://postgresql.1045698.n5.nabble.com/Queries-Regarding-Postgresql-Replication-tp4372554p4659365.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
*====> What is the procedure to make the failed master as working slave?* Check whether the following steps works for you... Assume the following is your use case., Master ----> Slave(Stand by..) Master replicating to slave. At time when master failed, the slave takes over as new master. Now your requirement to restart the failed master and reconfigure the same as standby for the new master. Stop the failed master. 1. Once the stand by taken over as master (once recovery.done and before any new data inserted...), copy file pg_control (available under data/global/) and the newly generated timeline history file available under archive folder (e-g., file like 00000002.history) 2. Remove all files under pg_xlog directory and in archive folder in the failed master . The above copied pg_control file, should be replaced in this failed master under data/global/). The above copied history should be copied in archive folder. Reconfigure the recovery.conf to point the new master Try starting the server..,(new standby) I hope it works ! Regards Senthil -- View this message in context: http://postgresql.1045698.n5.nabble.com/Queries-Regarding-Postgresql-Replication-tp4372554p4659360.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.