the master has two sync slave, which slave can promote to master and the other slave as the new master's slave?

From: lin <jluwln(at)163(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: the master has two sync slave, which slave can promote to master and the other slave as the new master's slave?
Date: 2017-03-19 04:52:50
Message-ID: 7ce99513.2325.15ae4e92b1e.Coremail.jluwln@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
everyone. I am puzzled about the question: the master A has two slave slave_1 , slave_2 , the version of postgres is 9.3. I want to promote one slave to master, and the other slave as the new master's slave, but which slave should can promote ?

get the master-slave information from old master:
postgres=# select * from pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid | 15377
usesysid | 10
usename | postgres
application_name | slave_1
client_addr | 10.20.16.201
client_hostname |
client_port | 46086
backend_start | 2017-03-19 12:42:02.026278+08
state | streaming
sent_location | 1/34FB0000
write_location | 1/34EB0000
flush_location | 1/34DB0000
replay_location | 1/34C4FFD8
sync_priority | 0
sync_state | async
-[ RECORD 2 ]----+------------------------------
pid | 15411
usesysid | 10
usename | postgres
application_name | slave_2
client_addr | 10.20.16.200
client_hostname |
client_port | 51102
backend_start | 2017-03-19 12:42:12.477886+08
state | streaming
sent_location | 1/414FD320
write_location | 1/414FD320
flush_location | 1/414FD320
replay_location | 1/3DD91468
sync_priority | 0
sync_state | async

1. which one can promote to master ,slave_1 or slave_2 ?
:: I think it is slave_2, because write_location slave_2 1/414FD320 > slave_1 (1/34FB0000), it is right?

2. If the slave_1 is sync state, which one can promote to master? I am puzzled.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lucas Possamai 2017-03-19 06:09:15 Re: the master has two sync slave, which slave can promote to master and the other slave as the new master's slave?
Previous Message Tony Cebzanov 2017-03-18 21:10:45 range partitioning of materialized views