Re: [GENERAL] the master has two sync slave, which slave can promoteto master and the other slave as the new master's slave?

Поиск
Список
Период
Сортировка
От Lucas Possamai
Тема Re: [GENERAL] the master has two sync slave, which slave can promoteto master and the other slave as the new master's slave?
Дата
Msg-id CAE_gQfWwV6c0Usvc1dGd22RRmGHCbwakQHda=X3MAtsnqsqGJA@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] the master has two sync slave, which slave can promote to masterand the other slave as the new master's slave?  (lin <jluwln@163.com>)
Список pgsql-general
2017-03-19 17:52 GMT+13:00 lin <jluwln@163.com>:
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.


You can promote any slave server to become a master server. It's up to you which one to do it; more info can be found here [1].

Example: 

slave_1 will be the new master and slave_2 will be the slave of that new master.


Make sure to have all the wal files and history files copied to the  slave_2 server otherwise it won't be able to switch timeline.


Lucas

В списке pgsql-general по дате отправления:

Предыдущее
От: lin
Дата:
Сообщение: [GENERAL] the master has two sync slave, which slave can promote to masterand the other slave as the new master's slave?
Следующее
От: Sylvain Marechal
Дата:
Сообщение: Re: [GENERAL] Best way to alter a foreign constraint