pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Logical replication monitoring
Date: Mon, 20 Aug 2018 09:17:02 +0300
Message-ID: <0fc9845b-05bd-3530-146e-38099d0275f1@matrix.gatewaynet.com> (raw)
In-Reply-To: <OF8734117D.4F6AF340-ON432582E8.0036DC83-432582E8.0038791D@iba.by>
References: <OF55FA9E73.3D2F6C8B-ON432582E5.0036C1C3-432582E5.00376604@LocalDomain>
	<OF8734117D.4F6AF340-ON432582E8.0036DC83-432582E8.0038791D@iba.by>

On 13/08/2018 13:16, AYahorau@ibagroup.eu wrote:
> Hello!
>
> Thank you for your suggestion.
> I  afraid this approach is not suitable for me. As a rule my postgresql log  on subscriber side contains a  bunch of the following entries:
>
> *ERROR:  terminating logical replication worker due to timeout*
> *00000 LOG:  worker process: logical replication worker for subscription 24578 (PID 6217) exited with exit code 1*
> *
> *How should I handle this situation? *
> *As I understand this is quite normal situation. But why is severity for it  an ERROR ?
In my short experience with logical replication, those ERRORs should be avoided, you better increase the relevant timeouts: wal_receiver_timeout , wal_sender_timeout . One hand tool we use here is 
tail_n_mail , it is tailored specifically for parsing PostgreSQL logs and sending emails with alerts.
>
> I have another assumption. Could you correct me if I am wrong.
> I found out in the source code that logical replication worker termination depends on *wal_receiver_timeout *paramer.
> So I propose setting *wal_receiver_timeout *to 0.
> In this case I think that monitoring of the following views *pg_stat_subscription, pg_publication *and *pg_stat_replication * is enough.
> In case if there  is some problem with connection or with replication *pg_stat_replication * will show nothing because wal sender will not be working otherwise it will give some information.
> Am I right? Are there any vulnerabilities in this approach ?
>
> Best regards,
> Andrei Yahorau
>
>
>
> From: Andrei Yahorau/IBA
> To: pgsql-admin@postgresql.org,
> Cc: Mikalai Keida/IBA@IBA
> Date: 10/08/2018 13:05
> Subject: Logical replication monitoring
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
>
> Hello PostgreSQL Community!
>
> I configured logical replication for PostgreSQL 10.4 on 2 machines, set wal_level to logical, created a publication on master node and created a subscription on standby node according to the 
> PostgreSQL documentation.
> Could you please suggest an approach for replication state monitoring.
>
> According to my experience the monitoring of *pg_stat_subscription *and *pg_publication, pg_replication_slots *unfortunately is not enough for this aim. Moreover standby database does not prohibit 
> write operations by default and it can lead to some inconsistency between these databases.
>
> For example a chain of queries as
> *SELECT pg_is_is_recovery()*,
> *SELECT * FROM pg_stat_replication* and
> *SELECT * FROM pg_stat_wal_receiver*
> provide insight into replication state for hot_standby replication.
>
> So is there a reliable way of replication state monitoring for logical replication?
>
> Best regards,
> Andrei Yahorau


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

view thread (10+ messages)  latest in thread

Message-ID: <0fc9845b-05bd-3530-146e-38099d0275f1@matrix.gatewaynet.com>
Permalink:  ../0fc9845b-05bd-3530-146e-38099d0275f1@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/0fc9845b-05bd-3530-146e-38099d0275f1@matrix.gatewaynet.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: achill@matrix.gatewaynet.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Logical replication monitoring
  In-Reply-To: <0fc9845b-05bd-3530-146e-38099d0275f1@matrix.gatewaynet.com>

* 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