pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to choose new master from slaves.?
6+ messages / 3 participants
[nested] [flat]

* How to choose new master from slaves.?
@ 2022-08-04 07:43  Sacheen Birhade <sacheen.birhade@veritas.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Sacheen Birhade @ 2022-08-04 07:43 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi All,

I have a very basic question about streaming replication feature of Postgres.
Let's assume I have servers A, B, C, D, & E with postgres installed with streaming replication as follow:
A  -->  B ( sync replication )
A  -->  C ( async replication )
A  -->  D ( async replication )
A  -->  E ( async replication )
A is master & rest are slaves.

Now my question is:
Assume replication link between A & B may/may not stable.  If A goes down, how will I choose my new master from slaves? What are criteria to choose new master?

Thanks,
Sacheen Birhade

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to choose new master from slaves.?
@ 2022-08-04 10:22  Ron <ronljohnsonjr@gmail.com>
  parent: Sacheen Birhade <sacheen.birhade@veritas.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Ron @ 2022-08-04 10:22 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 8/4/22 02:43, Sacheen Birhade wrote:
>
> Hi All,
>
> I have a very basic question about streaming replication feature of Postgres.
>
> Let’s assume I have servers A, B, C, D, & E with postgres installed with 
> streaming replication as follow:
>
> A à B ( sync replication )
>
> A à C ( async replication )
>
> A à D ( async replication )
>
> A à E ( async replication )
>
> A is master & rest are slaves.
>
> Now my question is:
>
> Assume replication link between A & B may/may not stable.  If A goes down, 
> how will I choose my new master from slaves? What are criteria to choose 
> new master?
>

By "link between A & B may/may not stable", do you mean that B might not 
actually be synchronized?

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to choose new master from slaves.?
@ 2022-08-06 08:40  Peter J. Holzer <hjp-pgsql@hjp.at>
  parent: Sacheen Birhade <sacheen.birhade@veritas.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Peter J. Holzer @ 2022-08-06 08:40 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 2022-08-04 07:43:28 +0000, Sacheen Birhade wrote:
> I have a very basic question about streaming replication feature of Postgres.
> Let’s assume I have servers A, B, C, D, & E with postgres installed with
> streaming replication as follow:
> A  à  B ( sync replication )
> A  à  C ( async replication )
> A  à  D ( async replication )
> A  à  E ( async replication )
> A is master & rest are slaves.
>  
> Now my question is:
> Assume replication link between A & B may/may not stable.

Using sync replication on an unstable link is probably not a good idea.
Every time the link goes down, A freezes. Is this what you want?

> If A goes down, how will I choose my new master from slaves? What are
> criteria to choose new master?

I would prefer B over the others because it is in sync with A, so you
don't lose data. All the other ones might.

Otherwise: For the same reason I would prefer B, I would prefer the one
with the most up-to-date data. But there might be other considerations,
e.g. the network connections (bandwidth and delays) between the
surviving members and the clients.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to choose new master from slaves.?
@ 2022-08-06 20:06  Ron <ronljohnsonjr@gmail.com>
  parent: Peter J. Holzer <hjp-pgsql@hjp.at>
  0 siblings, 1 reply; 6+ messages in thread

From: Ron @ 2022-08-06 20:06 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 8/6/22 03:40, Peter J. Holzer wrote:
> On 2022-08-04 07:43:28 +0000, Sacheen Birhade wrote:
>> I have a very basic question about streaming replication feature of Postgres.
>> Let’s assume I have servers A, B, C, D, & E with postgres installed with
>> streaming replication as follow:
>> A  à  B ( sync replication )
>> A  à  C ( async replication )
>> A  à  D ( async replication )
>> A  à  E ( async replication )
>> A is master & rest are slaves.
>>   
>> Now my question is:
>> Assume replication link between A & B may/may not stable.
> Using sync replication on an unstable link is probably not a good idea.
> Every time the link goes down, A freezes. Is this what you want?

I had to fight my end users about how to replicate a SQL Server database 
across a WAN.  They of course wanted it synchronously replicated, but I 
insisted that was a horrible idea, for the exact reason you mentioned 
(though it "only" freezes when the untransmitted transmitted transaction 
logs fill of the primary database's disk).


-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to choose new master from slaves.?
@ 2022-08-06 20:45  Peter J. Holzer <hjp-pgsql@hjp.at>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter J. Holzer @ 2022-08-06 20:45 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 2022-08-06 15:06:06 -0500, Ron wrote:
> On 8/6/22 03:40, Peter J. Holzer wrote:
> > Using sync replication on an unstable link is probably not a good idea.
> > Every time the link goes down, A freezes. Is this what you want?
> 
> I had to fight my end users about how to replicate a SQL Server database
> across a WAN.  They of course wanted it synchronously replicated, but I
> insisted that was a horrible idea, for the exact reason you mentioned
> (though it "only" freezes when the untransmitted transmitted transaction
> logs fill of the primary database's disk).

Doesn't synchronous mean that a commit only returns when the transaction
has been replicated?

(The database can work on other transactions in the meantime, but that
client is blocked.)

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: How to choose new master from slaves.?
@ 2022-08-06 21:13  Ron <ronljohnsonjr@gmail.com>
  parent: Peter J. Holzer <hjp-pgsql@hjp.at>
  0 siblings, 0 replies; 6+ messages in thread

From: Ron @ 2022-08-06 21:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 8/6/22 15:45, Peter J. Holzer wrote:
> On 2022-08-06 15:06:06 -0500, Ron wrote:
>> On 8/6/22 03:40, Peter J. Holzer wrote:
>>> Using sync replication on an unstable link is probably not a good idea.
>>> Every time the link goes down, A freezes. Is this what you want?
>> I had to fight my end users about how to replicate a SQL Server database
>> across a WAN.  They of course wanted it synchronously replicated, but I
>> insisted that was a horrible idea, for the exact reason you mentioned
>> (though it "only" freezes when the untransmitted transmitted transaction
>> logs fill of the primary database's disk).
> Doesn't synchronous mean that a commit only returns when the transaction
> has been replicated?

Correct.  I don't know what I was thinking when I wrote that.

Probably that transaction log data gets queued up and not deleted if it 
can't send the data across.

> (The database can work on other transactions in the meantime, but that
> client is blocked.)

Eventually any client doing writes blocks.  Readers might block if a writer 
took an exclusive lock,

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2022-08-06 21:13 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 07:43 How to choose new master from slaves.? Sacheen Birhade <sacheen.birhade@veritas.com>
2022-08-04 10:22 ` Ron <ronljohnsonjr@gmail.com>
2022-08-06 08:40 ` Peter J. Holzer <hjp-pgsql@hjp.at>
2022-08-06 20:06   ` Ron <ronljohnsonjr@gmail.com>
2022-08-06 20:45     ` Peter J. Holzer <hjp-pgsql@hjp.at>
2022-08-06 21:13       ` Ron <ronljohnsonjr@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox