Promoting 1 of 2 slaves

Started by Joseph Kreglohover 10 years ago3 messagesgeneral
Jump to latest
#1Joseph Kregloh
jkregloh@sproutloud.com

Hello,

I am getting ready to take my master server out of service today and
promote the slave to take it's place. In my current setup I have one master
server which ships WAL files to two separate slave servers.

My plan is to promote one of those slaves. How do I get the slave that I
promoted to start replicating to the other slave the moment I trigger it's
promotion?

Thanks,
-Joseph Kregloh

#2William Dunn
dunnwjr@gmail.com
In reply to: Joseph Kregloh (#1)
Re: Promoting 1 of 2 slaves

As I am aware, you would have two options depending on your configuration:

1. Change the primary_conninfo value on the second standby's
recovery.conf to point to the standby that has been promoted to master.
However, I think this would require that instance to be rebooted for the
configuration changes to take effect
2. Modify the DNS entries so that the host value in primary_conninfo points
to the new master rather than the old master

Does anyone know of another way?

*Will J. Dunn*
*willjdunn.com <http://willjdunn.com&gt;*

On Fri, Jul 17, 2015 at 9:43 AM, Joseph Kregloh <jkregloh@sproutloud.com>
wrote:

Show quoted text

Hello,

I am getting ready to take my master server out of service today and
promote the slave to take it's place. In my current setup I have one master
server which ships WAL files to two separate slave servers.

My plan is to promote one of those slaves. How do I get the slave that I
promoted to start replicating to the other slave the moment I trigger it's
promotion?

Thanks,
-Joseph Kregloh

#3Joseph Kregloh
jkregloh@sproutloud.com
In reply to: William Dunn (#2)
Re: Promoting 1 of 2 slaves

What I ended up doing was:

1. Stopping the master.
2. Triggering the promotion of slave A.
3. After slave A was promoted I turned it off and modified the
postgresql.conf file to make it a permanent master and setup WAL shipping
to slave B.
4. Rsync the pg_xlog directory from slave A to slave B and set
recovery_target_timeline to latest
5. Start slave B, then start slave A now master.

So far everything seems to work.

-Joseph Kregloh

On Tue, Jul 21, 2015 at 2:37 PM, William Dunn <dunnwjr@gmail.com> wrote:

Show quoted text

As I am aware, you would have two options depending on your configuration:

1. Change the primary_conninfo value on the second standby's
recovery.conf to point to the standby that has been promoted to master.
However, I think this would require that instance to be rebooted for the
configuration changes to take effect
2. Modify the DNS entries so that the host value in primary_conninfo points
to the new master rather than the old master

Does anyone know of another way?

*Will J. Dunn*
*willjdunn.com <http://willjdunn.com&gt;*

On Fri, Jul 17, 2015 at 9:43 AM, Joseph Kregloh <jkregloh@sproutloud.com>
wrote:

Hello,

I am getting ready to take my master server out of service today and
promote the slave to take it's place. In my current setup I have one master
server which ships WAL files to two separate slave servers.

My plan is to promote one of those slaves. How do I get the slave that I
promoted to start replicating to the other slave the moment I trigger it's
promotion?

Thanks,
-Joseph Kregloh