JDBC Postgres Failover with quorum based synchronous replication

From: Debraj Manna <subharaj(dot)manna(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: JDBC Postgres Failover with quorum based synchronous replication
Date: 2018-06-17 06:01:32
Message-ID: CAF6DVKMn3J04P2PW1gi4mwpQ1+Z6V_dKU4fpRwdZS8NXonx08g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi

Let's say I am using quorum based synchronous replication
<https://wiki.postgresql.org/wiki/New_in_postgres_10#Quorum_Commit_for_Synchronous_Replication>
either
ANY or FIRST in synchronous_standby_names

I am trying to read from slave as discussed here
<https://jdbc.postgresql.org/documentation/head/connect.html>.

jdbc:postgresql://node1,node2,node3/accounting?targetServerType=preferSlave&loadBalanceHosts=true

Can someone let me know

1. How does a slave is selected? Is a slave randomly selected or a slave
is preferred which has zero lag or the minimum lag?
2. Is there any setting in jdbc url which will only select the slave
with zero replication and if no such slave exists then read will be sent to
master ?

Thanks,

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Vijaykumar Jain 2018-06-17 08:41:03 Re: [External] JDBC Postgres Failover with quorum based synchronous replication
Previous Message Rui DeSousa 2018-06-15 16:52:27 Re: How to get current timeline of host in postgres 10.4?