pgbasebackup necessary for master slave change?

Started by Subhankar Chattopadhyayover 9 years ago7 messagesgeneral
Jump to latest
#1Subhankar Chattopadhyay
subho.atg@gmail.com

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Chris Travers
chris.travers@gmail.com
In reply to: Subhankar Chattopadhyay (#1)
Re: pgbasebackup necessary for master slave change?

On Thu, Dec 8, 2016 at 10:33 AM, Subhankar Chattopadhyay <
subho.atg@gmail.com> wrote:

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

Depending on your version and circumstance, pg_rewind may address your
problem.
https://www.postgresql.org/docs/9.5/static/app-pgrewind.html

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Best Wishes,
Chris Travers

Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor
lock-in.
http://www.efficito.com/learn_more

#3Subhankar Chattopadhyay
subho.atg@gmail.com
In reply to: Chris Travers (#2)
Re: pgbasebackup necessary for master slave change?

I am on 9.4. Doesn't look like we have it available on 9.4.

Do we have any other option?

On Thu, Dec 8, 2016 at 3:15 PM, Chris Travers <chris.travers@gmail.com> wrote:

On Thu, Dec 8, 2016 at 10:33 AM, Subhankar Chattopadhyay
<subho.atg@gmail.com> wrote:

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

Depending on your version and circumstance, pg_rewind may address your
problem.
https://www.postgresql.org/docs/9.5/static/app-pgrewind.html

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Best Wishes,
Chris Travers

Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor
lock-in.
http://www.efficito.com/learn_more

--

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Achilleas Mantzios
achill@matrix.gatewaynet.com
In reply to: Subhankar Chattopadhyay (#1)
Re: pgbasebackup necessary for master slave change?

On 08/12/2016 11:33, Subhankar Chattopadhyay wrote:

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

pg_rewind

Subhankar Chattopadhyay
Bangalore, India

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Subhankar Chattopadhyay
subho.atg@gmail.com
In reply to: Achilleas Mantzios (#4)
Re: pgbasebackup necessary for master slave change?

pg_rewind cannot be used as I am on 9.4.

Anything else?

On Thu, Dec 8, 2016 at 3:23 PM, Achilleas Mantzios
<achill@matrix.gatewaynet.com> wrote:

On 08/12/2016 11:33, Subhankar Chattopadhyay wrote:

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

pg_rewind

Subhankar Chattopadhyay
Bangalore, India

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6Chris Travers
chris.travers@gmail.com
In reply to: Subhankar Chattopadhyay (#5)
Re: pgbasebackup necessary for master slave change?

On Thu, Dec 8, 2016 at 11:01 AM, Subhankar Chattopadhyay <
subho.atg@gmail.com> wrote:

pg_rewind cannot be used as I am on 9.4.

Anything else?

Upgrade to 9.5 or 9.6? ;-)

This is a known limitation in Postgres that pg_rewind was written to
address.

On Thu, Dec 8, 2016 at 3:23 PM, Achilleas Mantzios
<achill@matrix.gatewaynet.com> wrote:

On 08/12/2016 11:33, Subhankar Chattopadhyay wrote:

Hi,

Few days back I had asked if it is needed to to pg_basebackup for
every database update. From John I understood that it is unnecessary
and if the slave is syncing, even if it is catching up, it would be
able to sync without doing pg_basebackup. This is working also for me.

However, for a failover scenario, where a master goes down, and I make
the slave as master, and then when the old master comes back as a
slave again, if I don't take pg_basebackup from the new master, it
cannot follow the new master. This is kind of an overhead. Is there a
way I can make the old master follow the new master without having to
do full backup?

pg_rewind

Subhankar Chattopadhyay
Bangalore, India

--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--

Subhankar Chattopadhyay
Bangalore, India

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Best Wishes,
Chris Travers

Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor
lock-in.
http://www.efficito.com/learn_more

#7Michael Paquier
michael@paquier.xyz
In reply to: Chris Travers (#6)
Re: pgbasebackup necessary for master slave change?

On Thu, Dec 8, 2016 at 7:08 PM, Chris Travers <chris.travers@gmail.com> wrote:

On Thu, Dec 8, 2016 at 11:01 AM, Subhankar Chattopadhyay
<subho.atg@gmail.com> wrote:

pg_rewind cannot be used as I am on 9.4.

Anything else?

Upgrade to 9.5 or 9.6? ;-)

This is a known limitation in Postgres that pg_rewind was written to
address.

FWIW I maintain a version that works on 9.4:
https://github.com/vmware/pg_rewind
And that's battle-proven.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general