Re: How to test replication without doing a failover

From: Paul Smith <paul(at)pscs(dot)co(dot)uk>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: How to test replication without doing a failover
Date: 2022-11-10 15:43:26
Message-ID: 25cee62c-70d6-5c7d-def8-0988823e6d39@pscs.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 10/11/2022 14:59, Edwin UY wrote:
> How do I test and confirm whether replication is working or not
> besides depending on just running the SQL below?
>
> select pg_is_in_recovery() ;
>
> select * from pg_stat_replication ;
>
>
> Is it possible to force/initiate a log transaction and see if that
> gets replicated or not? I mean for example on Oracle we can do a
> switch logfile and check if that log gets shipped across and applied
> on the standby, is there something similar in PostgreSQL?

You can (usually) access the replica in read-only mode

So, what I do is do a transaction on the master and see if it appears on
the replica. On a live database that often happens automatically, so I
just look at, for instance, the latest entry in a busy table on the
master, and check it's the same on the replica. If you do this a couple
of times as things change on the master, then you'll know whether or not
it's replicating properly

Paul

--

Paul Smith Computer Services
Tel: 01484 855800
Vat No: GB 685 6987 53

Sign up for news & updates at http://www.pscs.co.uk/go/subscribe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Holger Jakobs 2022-11-10 15:52:57 Re: How to test replication without doing a failover
Previous Message Edwin UY 2022-11-10 14:59:20 How to test replication without doing a failover