pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Domen Šetar <domen.setar@izum.si>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Postgresql-11 confusing situtation
Date: Wed, 5 Jun 2019 07:14:23 -0700
Message-ID: <d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.com> (raw)
In-Reply-To: <1712870b1d2a457f975645383a2e0f9a@izum.si>
References: <1712870b1d2a457f975645383a2e0f9a@izum.si>

On 6/5/19 5:46 AM, Domen Šetar wrote:
> Hi,
> 
> I’m using Postgresql 11.3 on Centos 7.6.18.10 server.
> 
> I have very unusual issue which I don’t know if it is OK:
> 
> I have running postgresql server with default instance:
> 
> [root@pgpmaster ~]# systemctl status postgresql-11
> 
> ● postgresql-11.service - PostgreSQL 11 database server
> 
>     Loaded: loaded (/usr/lib/systemd/system/postgresql-11.service; 
> enabled; vendor preset: disabled)
> 
>     Active: active (running) since Wed 2019-06-05 14:37:21 CEST; 49s ago
> 
>       Docs: https://www.postgresql.org/docs/11/static/
> 
>    Process: 3552 
> ExecStartPre=/usr/pgsql-11/bin/postgresql-11-check-db-dir ${PGDATA} 
> (code=exited, status=0/SUCCESS)
> 
> Main PID: 3576 (postmaster)
> 
>      Tasks: 9
> 
>     CGroup: /system.slice/postgresql-11.service
> 
> ├─3576 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/
> 
> ├─3609 postgres: logger
> 
> ├─3621 postgres: checkpointer
> 
> ├─3622 postgres: background writer
> 
> ├─3623 postgres: walwriter
> 
> ├─3624 postgres: autovacuum launcher
> 
> ├─3625 postgres: archiver
> 
> ├─3626 postgres: stats collector
> 
>             └─3627 postgres: logical replication launcher
> 
> Jun 05 14:37:20 pgpmaster.localhost systemd[1]: Starting PostgreSQL 11 
> database server...
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.923 CEST [3576] LOG:  listening on IPv4 address "0.0.0.0", port 
> 5432
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.924 CEST [3576] LOG:  listening on IPv6 address "::", port 5432
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.928 CEST [3576] LOG:  listening on Unix socket 
> "/var/run/postgresql/.s.PGSQL.5432"
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.026 CEST [3576] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.123 CEST [3576] LOG:  redirecting log output to logging 
> collector process
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.123 CEST [3576] HINT:  Future log output will appear in 
> directory "log".
> 
> Jun 05 14:37:21 pgpmaster.localhost systemd[1]: Started PostgreSQL 11 
> database server.
> 
> If I restart it using systemctl restart postgresql-11 command, 
> everything is OK, but if I use commands:
> 
> # pg_ctl -D /var/lib/pgsql/11/data/ -m immediate stop
> 
> # pg_ctl -D /var/lib/pgsql/11/data/ -m immediate start

Don't do that. You are mixing starting procedures. pg_ctl is directly 
starting the server without going through systemd. Since systemd did not 
start the server it sees it as dead.

> 
> Then I get following situtation:
> 
> # systemctl status postgresql-11
> 
> ● postgresql-11.service - PostgreSQL 11 database server
> 
>     Loaded: loaded (/usr/lib/systemd/system/postgresql-11.service; 
> enabled; vendor preset: disabled)
> 
> *Active: inactive (dead) since Wed 2019-06-05 14:41:32 CEST; 1min 40s ago*
> 
>       Docs: https://www.postgresql.org/docs/11/static/
> 
>    Process: 3576 ExecStart=/usr/pgsql-11/bin/postmaster -D ${PGDATA} 
> (code=exited, status=0/SUCCESS)
> 
>    Process: 3552 
> ExecStartPre=/usr/pgsql-11/bin/postgresql-11-check-db-dir ${PGDATA} 
> (code=exited, status=0/SUCCESS)
> 
> Main PID: 3576 (code=exited, status=0/SUCCESS)
> 
> Jun 05 14:37:20 pgpmaster.localhost systemd[1]: Starting PostgreSQL 11 
> database server...
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.923 CEST [3576] LOG:  listening on IPv4 address "0.0.0.0", port 
> 5432
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.924 CEST [3576] LOG:  listening on IPv6 address "::", port 5432
> 
> Jun 05 14:37:20 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:20.928 CEST [3576] LOG:  listening on Unix socket 
> "/var/run/postgresql/.s.PGSQL.5432"
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.026 CEST [3576] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.123 CEST [3576] LOG:  redirecting log output to logging 
> collector process
> 
> Jun 05 14:37:21 pgpmaster.localhost postmaster[3576]: 2019-06-05 
> 14:37:21.123 CEST [3576] HINT:  Future log output will appear in 
> directory "log".
> 
> Jun 05 14:37:21 pgpmaster.localhost systemd[1]: Started PostgreSQL 11 
> database server.
> 
> # ps agx | grep postgre
> 
> 4592 pts/0    S      0:00 /usr/pgsql-11/bin/postgres -D 
> /var/lib/pgsql/11/data
> 
> 4593 ?        Ss     0:00 postgres: logger
> 
> 4595 ?        Ss     0:00 postgres: checkpointer
> 
> 4596 ?        Ss     0:00 postgres: background writer
> 
> 4597 ?        Ss     0:00 postgres: walwriter
> 
> 4598 ?        Ss     0:00 postgres: autovacuum launcher
> 
> 4599 ?        Ss     0:00 postgres: archiver
> 
> 4600 ?        Ss     0:00 postgres: stats collector
> 
> 4601 ?        Ss     0:00 postgres: logical replication launcher
> 
> 4630 pts/0    S+     0:00 grep --color=auto postgre
> 
> $ pg_ctl -D /var/lib/pgsql/11/data/ status
> 
> pg_ctl: server is running (PID: 4592)
> 
> /usr/pgsql-11/bin/postgres "-D" "/var/lib/pgsql/11/data"
> 
> Systemctl shows that database is dead, but it is actually running.
> 
> Can someone explain this behavioure?
> 
> Best regards!
> 
> izum
> 
> 	
> 
> Domen Šetar
> /Computer Systems Support/
> IZUM – Institute of Information Science| Prešernova ulica 17 | 2000 
> Maribor |Slovenia/
> /T: +386 2 25 20 339| M: +386 41 676 342| www.izum.si 
> <http://www.izum.si/;|domen.setar@izum.si <mailto:domen.setar@izum.si>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (4+ messages)  latest in thread

Message-ID: <d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.com>
Permalink:  ../d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.com/
Also on:    postgresql.org/message-id/d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.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 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: adrian.klaver@aklaver.com, domen.setar@izum.si
  Subject: Re: Postgresql-11 confusing situtation
  In-Reply-To: <d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.com>
  References: <1712870b1d2a457f975645383a2e0f9a@izum.si> <d2e058ce-bdb6-baa0-602f-ef523ed62ade@aklaver.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