Обсуждение: how to fail over slave to master

Поиск
Список
Период
Сортировка

how to fail over slave to master

От
Pepe TD Vo
Дата:
Hello,

I have a problem with my master's Postgresql service.  I can't start up Postgresql, something corrupted and the Postgresql service is down.  The slave is still up and running, I wonder how to turn slave to primary and fixing the master server.  Once the master server is fixed, how can I fail it back?

Please advise.


Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success


Re: how to fail over slave to master

От
Amine Tengilimoglu
Дата:
You need to promote standby server, you can do that pg_ctl promote command. And also you need to use pg_rewind command for setup the old master as a standby server. So you can start with investigate pg_ctl promote and pg_rewind...

28 Ara 2020 Pzt 21:29 tarihinde Pepe TD Vo <pepevo@yahoo.com> şunu yazdı:
Hello,

I have a problem with my master's Postgresql service.  I can't start up Postgresql, something corrupted and the Postgresql service is down.  The slave is still up and running, I wonder how to turn slave to primary and fixing the master server.  Once the master server is fixed, how can I fail it back?

Please advise.


Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success


Re: how to fail over slave to master

От
Pepe TD Vo
Дата:
Version 12 and can you show me step by step what needs to do?  I found a document in version 10 to promote salve to master with pg_ctl and create recovery.conf.  Recovery.conf is not existed in version 12 but in version 1.

Do I need to run pg_ctl in slave server?  Create recovery.conf in master, but master is a failure right now.
   

Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success




On Monday, December 28, 2020, 01:38:10 PM EST, Amine Tengilimoglu <aminetengilimoglu@gmail.com> wrote:


You need to promote standby server, you can do that pg_ctl promote command. And also you need to use pg_rewind command for setup the old master as a standby server. So you can start with investigate pg_ctl promote and pg_rewind...

28 Ara 2020 Pzt 21:29 tarihinde Pepe TD Vo <pepevo@yahoo.com> şunu yazdı:
Hello,

I have a problem with my master's Postgresql service.  I can't start up Postgresql, something corrupted and the Postgresql service is down.  The slave is still up and running, I wonder how to turn slave to primary and fixing the master server.  Once the master server is fixed, how can I fail it back?

Please advise.


Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success


Re: how to fail over slave to master

От
Scott Ribe
Дата:
> On Dec 28, 2020, at 11:54 AM, Pepe TD Vo <pepevo@yahoo.com> wrote:
>
> Version 12 and can you show me step by step what needs to do?  I found a document in version 10 to promote salve to
masterwith pg_ctl and create recovery.conf.  Recovery.conf is not existed in version 12 but in version 1. 

1) The parameters that used to be set in recovery.conf are instead set in postgresql.conf in 12 & above.

2) They are set on your replica; otherwise it would not come up as a replica. They are not needed in a master.




Re: how to fail over slave to master

От
Pepe TD Vo
Дата:
In verison 12, postgresql.auto.conf to replace recovery.conf

do I  need to run 
1. pg_ctl promote -D Pg_data (in slave?)
2. pg_rewind --target -pg_data=master_server (aliase hostname of master) --source-server="port=5433 user=replica dbname=postgres" --progress
3. change postgresql.cond parameter, primary_slot_name ='main'

do I need to run pg_rewind for each dbname? 
I don't understand why pg_rewind set the port=5433 not 5432?

Bach-Nga

No one in this world is pure and perfect.  If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.EmojiEmojiEmoji
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success




On Monday, December 28, 2020, 02:10:14 PM EST, Scott Ribe <scott_ribe@elevated-dev.com> wrote:


> On Dec 28, 2020, at 11:54 AM, Pepe TD Vo <pepevo@yahoo.com> wrote:

>
> Version 12 and can you show me step by step what needs to do?  I found a document in version 10 to promote salve to master with pg_ctl and create recovery.conf.  Recovery.conf is not existed in version 12 but in version 1.


1) The parameters that used to be set in recovery.conf are instead set in postgresql.conf in 12 & above.

2) They are set on your replica; otherwise it would not come up as a replica. They are not needed in a master.