pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: TSG <support@telium.ca>
To: pgsql-admin@lists.postgresql.org
Subject: Re: How to tell if PGSQL 8.4 is in standby mode
Date: Mon, 16 Apr 2018 08:07:58 +0200
Message-ID: <1523858878.2304.5.camel@cybertec.at> (raw)
In-Reply-To: <002701d3d529$76a8dd70$63fa9850$@telium.ca>
References: <002701d3d529$76a8dd70$63fa9850$@telium.ca>

TSG wrote:
> I have a PostgreSQL 8.4 database that I'm am trying to start in standby mode
> (I am shipping my own logs from the active DB). I think my standby DB is in
> standby/recovery mode but I'm not sure how to tell.

I probably don't have to tell you that you shouldn't be using 8.4.

> First of all, pg_controldata says the database is "shut down":

Don't know offhand if that is significant or not ...

> But that contradicts the status command output:
> 
> [root@node2 pgsql]# sudo -u postgres pg_ctl status -D /var/lib/pgsql/data 
> pg_ctl: server is running (PID: 35852)
> /usr/bin/postgres "-D" "/var/lib/pgsql/data"
>  
> 
> And when I try to start the database it says it's already running:
> 
> [root@node2 pgsql]# sudo -u postgres pg_ctl start -D /var/lib/pgsql/data  
> pg_ctl: another server might be running; trying to start server anyway
> [2018-04-15 23:06:11 GMT] FATAL:  lock file "postmaster.pid" already exists
> [2018-04-15 23:06:11 GMT] HINT:  Is another postmaster (PID 35852) running in data directory "/var/lib/pgsql/data"?
> pg_ctl: could not start server
> Examine the log output.

... but that convinces me that the server is running.

> And I can see that my recovery.conf is still in place:
> 
> [root@node2 pgsql]# cat data/recovery.conf
> restore_command='pg_standby -r 10 -t /var/run/myapp.trigger /var/lib/pgsql/data/myapp-archive "%f" "%p"'
> And finally, I see an every growing list of files in the archive directory.
> 
> So, is there a way to tell if the wal (archive) files are being applied to the database?

You might want to look into the PostgreSQL log file if there are messages
that tell you what is going on.

Also, you can use "ps" to see if there is an instance of "pg_standby" running.
If yes, what WAL file is it working on? Is that WAL file present?
You can use "strace" to attach to the "pg_standby" process and see what it
is doing.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




view thread (6+ messages)  latest in thread

Message-ID: <1523858878.2304.5.camel@cybertec.at>
Permalink:  ../1523858878.2304.5.camel@cybertec.at/
Also on:    postgresql.org/message-id/1523858878.2304.5.camel@cybertec.at

 · 

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: laurenz.albe@cybertec.at, support@telium.ca, pgsql-admin@lists.postgresql.org
  Subject: Re: How to tell if PGSQL 8.4 is in standby mode
  In-Reply-To: <1523858878.2304.5.camel@cybertec.at>

* 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