Re: Asynchronous streaming replication in postgresql

Lists: pgsql-cluster-hackers
From: "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com>
To: "pgsql-cluster-hackers(at)postgresql(dot)org" <pgsql-cluster-hackers(at)postgresql(dot)org>
Subject: Asynchronous streaming replication in postgresql
Date: 2015-03-12 05:56:49
Message-ID: 78A4D6BFBAA5BA49A5E94DA00A6A76E35354AE@AZ-FFEXMB04.global.avaya.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cluster-hackers

Hi,

I am new to postgreSql and evaluating the streaming replication for my use case. My use case is:

1. Need to replicate data from primary database (master) to secondary database (slave) asynchronously.
2. If master goes down, the slave should automatically be promoted to master.
3. Later, when the original primary server (original master) is brought up again, it should obtain back its master role and the new master should assume the slave again as it was with original setup.

For #1, the streaming replication of postgresql is good enough.
For #2, we need to create the trigger file in slave. This can be done manually. How can we do this automatically?
For #3, this seems to be quite complicated. Is this possible using streaming replication and if yes then how can this be achieved?

Your help is greatly appreciated in this regard.
Thank you very much..


From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com>
Cc: pgsql-cluster-hackers(at)postgresql(dot)org
Subject: Re: Asynchronous streaming replication in postgresql
Date: 2015-03-12 06:15:14
Message-ID: CAECtzeXj-WqZqah6kvvFm4_6i6X5Mg-VY+DNydGQbK7WNhxFJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토SQL : Postg사설

Le 12 mars 2015 06:57, "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com> a
écrit :
>
> Hi,
>
>
>
> I am new to postgreSql and evaluating the streaming replication for my
use case. My use case is:
>
>
>
> 1. Need to replicate data from primary database (master) to
secondary database (slave) asynchronously.
>
> 2. If master goes down, the slave should automatically be promoted
to master.
>
> 3. Later, when the original primary server (original master) is
brought up again, it should obtain back its master role and the new master
should assume the slave again as it was with original setup.
>
>
>
> For #1, the streaming replication of postgresql is good enough.
>
> For #2, we need to create the trigger file in slave. This can be done
manually. How can we do this automatically?
>
> For #3, this seems to be quite complicated. Is this possible using
streaming replication and if yes then how can this be achieved?
>

This is doable with pacemaker or something alike. Wether this is a smart
move or not is definitely arguable :-) I know for sure that I don't want
that kind of automatic actions on my servers.

BTW, this isn't the list you should use for that kind of questions. Pgsql -
general would be better.


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com>
Cc: "pgsql-cluster-hackers(at)postgresql(dot)org" <pgsql-cluster-hackers(at)postgresql(dot)org>
Subject: Re: Asynchronous streaming replication in postgresql
Date: 2015-03-13 09:52:56
Message-ID: CA+U5nMJ0emE2E2uBGZ5k5KyJ1chy8T2d=-uRFmQ2BqSkpiq0xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg스포츠 토토 베트맨SQL : Postg스포츠

On 12 March 2015 at 05:56, Deole, Pushkar (Pushkar) <pdeole(at)avaya(dot)com> wrote:

> I am new to postgreSql and evaluating the streaming replication for my use
> case. My use case is:
>
>
>
> 1. Need to replicate data from primary database (master) to secondary
> database (slave) asynchronously.
>
> 2. If master goes down, the slave should automatically be promoted to
> master.
>
> 3. Later, when the original primary server (original master) is
> brought up again, it should obtain back its master role and the new master
> should assume the slave again as it was with original setup.
>
>
>
> For #1, the streaming replication of postgresql is good enough.
>
> For #2, we need to create the trigger file in slave. This can be done
> manually. How can we do this automatically?

Look at repmgr, it does what you need.

> For #3, this seems to be quite complicated. Is this possible using streaming
> replication and if yes then how can this be achieved?

Bad idea to do that automatically.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


From: "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: "pgsql-cluster-hackers(at)postgresql(dot)org" <pgsql-cluster-hackers(at)postgresql(dot)org>
Subject: Re: Asynchronous streaming replication in postgresql
Date: 2015-03-13 10:28:25
Message-ID: 78A4D6BFBAA5BA49A5E94DA00A6A76E3535640@AZ-FFEXMB04.global.avaya.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cluster-hackers

Can you elaborate on " Bad idea to do that automatically."

In production, that has to happen automatically, isn't it? There won't be an administrator available all the time to do a failover in case primary goes down..

-----Original Message-----
From: Simon Riggs [mailto:simon(at)2ndQuadrant(dot)com]
Sent: Friday, March 13, 2015 3:23 PM
To: Deole, Pushkar (Pushkar)
Cc: pgsql-cluster-hackers(at)postgresql(dot)org
Subject: Re: [pgsql-cluster-hackers] Asynchronous streaming replication in postgresql

On 12 March 2015 at 05:56, Deole, Pushkar (Pushkar) <pdeole(at)avaya(dot)com> wrote:

> I am new to postgreSql and evaluating the streaming replication for my
> use case. My use case is:
>
>
>
> 1. Need to replicate data from primary database (master) to secondary
> database (slave) asynchronously.
>
> 2. If master goes down, the slave should automatically be promoted to
> master.
>
> 3. Later, when the original primary server (original master) is
> brought up again, it should obtain back its master role and the new
> master should assume the slave again as it was with original setup.
>
>
>
> For #1, the streaming replication of postgresql is good enough.
>
> For #2, we need to create the trigger file in slave. This can be done
> manually. How can we do this automatically?

Look at repmgr, it does what you need.

> For #3, this seems to be quite complicated. Is this possible using
> streaming replication and if yes then how can this be achieved?

Bad idea to do that automatically.

--
Simon Riggs https://urldefense.proofpoint.com/v2/url?u=http-3A__www.2ndQuadrant.com_&d=AwIBaQ&c=BFpWQw8bsuKpl1SgiZH64Q&r=9JxdEvGq7qy3NnL3UxN47w&m=40Wa40JcHBzcpMHkes_PqVNhpVzn4pK5rDc4JEb1XcI&s=BTCgqd3RbpTPwz5yzUOwfvuP0p1OkgnFGfKcfF6BeDU&e=
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: "Deole, Pushkar (Pushkar)" <pdeole(at)avaya(dot)com>
Cc: "pgsql-cluster-hackers(at)postgresql(dot)org" <pgsql-cluster-hackers(at)postgresql(dot)org>
Subject: Re: Asynchronous streaming replication in postgresql
Date: 2015-03-13 11:03:21
Message-ID: CA+U5nMK7jWSp3tx5Ab_UMHyQ2-MxyY3Jr7PNWMAVxaQ20=AHqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cluster-hackers

On 13 March 2015 at 10:28, Deole, Pushkar (Pushkar) <pdeole(at)avaya(dot)com> wrote:
> Can you elaborate on " Bad idea to do that automatically."
>
> In production, that has to happen automatically, isn't it? There won't be an administrator available all the time to do a failover in case primary goes down..

Automatic failover is OK. Automatic failback is not OK.

>> For #3, this seems to be quite complicated. Is this possible using
>> streaming replication and if yes then how can this be achieved?
>
> Bad idea to do that automatically.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services