From: Edson Carlos Ericksson Richter <richter@simkorp.com.br>
To: pgsql-general@lists.postgresql.org
Subject: Re: Postgresql Split Brain: Which one is latest
Date: Tue, 10 Apr 2018 12:35:00 -0300
Message-ID: <45638fd9-29c2-f3e8-4399-30f011cb2ecd@simkorp.com.br> (raw)
In-Reply-To: <CANu8FiyQfa5mxj6aOc5yYsfis_ArEOiDHJOyb6jcGzi0wY6WEA@mail.gmail.com>
References: <CAN6gwKz3jOEes0JxRo44JTz+crysqg+LtRk_Je1rvZeUrPCi+Q@mail.gmail.com>
<fb6d574a-6d7a-56e8-25c8-a30f40c0ad42@aklaver.com>
<CAN6gwKzRyw=0EWb0eQg1qTDSoQQY+B0_Tn916KA+467sqKuchQ@mail.gmail.com>
<CANu8FiyQfa5mxj6aOc5yYsfis_ArEOiDHJOyb6jcGzi0wY6WEA@mail.gmail.com>
Em 10/04/2018 12:28, Melvin Davidson escreveu:
>
>
> On Tue, Apr 10, 2018 at 11:04 AM, Vikas Sharma <shavikas@gmail.com
> <mailto:shavikas@gmail.com>> wrote:
>
> Hi Adrian,
>
> This can be a good example: Application server e.g. tomcat having
> two entries to connect to databases, one for master and 2nd for
> Slave (ideally used when slave becomes master). If application is
> not able to connect to first, it will try to connect to 2nd.
>
> Regards
> Vikas
>
> On 10 April 2018 at 15:26, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 04/10/2018 06:50 AM, Vikas Sharma wrote:
>
> Hi,
>
> We have postgresql 9.5 with streaming
> replication(Master-slave) and automatic failover. Due to
> network glitch we are in master-master situation for quite
> some time. Please, could you advise best way to confirm
> which node is latest in terms of updates to the postgres
> databases.
>
>
> It might help to know how the two masters received data when
> they where operating independently.
>
>
> Regards
> Vikas Sharma
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
>
> *Vikas,
>
> *
> *Presuming the the real "master" will have additional records/rows
> inserted in the tables,
> *
> *if you run ANALYZE on the database(s) in both "masters", then execute
> the following query
> *
> *on both, whichever returns the highest count would be the real "master".
>
> SELECT sum(c.reltuples::bigint)
> FROM pg_stat_all_tables s
> JOIN pg_class c ON c.oid = s.relid
> WHERE s.relname NOT LIKE 'pg_%'
> AND s.relname NOT LIKE 'sql_%';*
>
>
> --
> *Melvin Davidson**
> Maj. Database & Exploration Specialist**
> Universe Exploration Command – UXC*
> Employment by invitation only!
I'm just trying to understand the scenario...
Correct me if I'm wrong, if you had two servers acting as master for a
while, then you have inserted/updated records on both servers, and you
will need some kind of "merge" of records into one of the databases,
that will become the new updated master...
If you have "sequences" (or "serial" fields), then you will get a bit
trouble in your hands.
Regards,
Edson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: richter@simkorp.com.br
Subject: Re: Postgresql Split Brain: Which one is latest
In-Reply-To: <45638fd9-29c2-f3e8-4399-30f011cb2ecd@simkorp.com.br>
References: <CAN6gwKz3jOEes0JxRo44JTz+crysqg+LtRk_Je1rvZeUrPCi+Q@mail.gmail.com> <fb6d574a-6d7a-56e8-25c8-a30f40c0ad42@aklaver.com> <CAN6gwKzRyw=0EWb0eQg1qTDSoQQY+B0_Tn916KA+467sqKuchQ@mail.gmail.com> <CANu8FiyQfa5mxj6aOc5yYsfis_ArEOiDHJOyb6jcGzi0wY6WEA@mail.gmail.com> <45638fd9-29c2-f3e8-4399-30f011cb2ecd@simkorp.com.br>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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