>From: Condor <con...@stz-bg.com>
>To: Glyn Astill <glynast...@yahoo.co.uk>
>Cc: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>; 
>"pgsql-general-ow...@postgresql.org" <pgsql-general-ow...@postgresql.org>
>Sent: Thursday, 31 August 2017, 09:42:17 GMT+1
>Subject: Re: [GENERAL] How to check streaming replication status

>>> My question is: How I can check the replication status when the
>> slave
>>> does not accept connections ?
>>
>> That's right for a server in recovery you need to call
>> pg_last_xlog_receive_location() or pg_last_xlog_replay_location() to
>> get the current xlog position.
>
>
>Yes,
>but my question is how to call them when Im unable to connect with slave
>even when
>replication is over. How I can ask the slave server: Are you in recovery
>mode ?
>

Define "unable to connect", in your previous example you appeared to be 
connected to the slave and attempting to call pg_current_xlog_location() ...

If you want to know if postgres is in recovery call pg_is_in_recovery()

https://www.postgresql.org/docs/current/static/functions-admin.html

>
>What is the last wal file send from master, which file you processing
>now ?
>How far behind you ?
>
>As I ask:  My question is: How I can check the replication status when
>the slave does not accept connections ?

Again I think you need to define "the slave does not accept connections".

If you've not configured the slave to be a hot standby, then try setting 
hot_standby=on in postgresql.conf on the slave.  If you don't want to do that 
you can run the pg_controldata executable on the slave to see the cluster state.

You should also be able to see streaming replication slave lag on the master by 
looking at pg_stat_replication and using pg_xlog_location_diff()

hth

Reply via email to