Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYX41-0006Yu-A6 for pgsql-general@arkaria.postgresql.org; Wed, 05 Jun 2019 14:38:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hYX40-0006hn-1W for pgsql-general@arkaria.postgresql.org; Wed, 05 Jun 2019 14:38:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYX3z-0006hf-GH for pgsql-general@lists.postgresql.org; Wed, 05 Jun 2019 14:38:51 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYX3v-0007qv-P6 for pgsql-general@lists.postgresql.org; Wed, 05 Jun 2019 14:38:50 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.15.2/8.15.2/Debian-8) with ESMTPS id x55EcdEb006349 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 5 Jun 2019 17:38:44 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id x55EcdA6001968 for ; Wed, 5 Jun 2019 17:38:39 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Subject: Re: Postgresql-11 confusing situtation To: pgsql-general@lists.postgresql.org References: <1712870b1d2a457f975645383a2e0f9a@izum.si> Message-ID: Date: Wed, 5 Jun 2019 17:38:39 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <1712870b1d2a457f975645383a2e0f9a@izum.si> Content-Type: multipart/alternative; boundary="------------B546418B599F614715C53E18" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.100.3 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-26.0 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_HAM_SIGNAT1,DYN_SPAM_MED6,HTML_MESSAGE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------B546418B599F614715C53E18 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 5/6/19 3:46 μ.μ., 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 run those as root. I guess you didn't run pg_ctl as root (since it worked) > > 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? > if you bypass systemctl then systemd has no way to tell if the service is up or down just by grep. > > 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 |domen.setar@izum.si > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------B546418B599F614715C53E18 Content-Type: multipart/related; boundary="------------6F07F22ACA8F9261D64C06CF" --------------6F07F22ACA8F9261D64C06CF Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 5/6/19 3:46 μ.μ., 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 run those as root. I guess you didn't run pg_ctl as root (since it worked)

 

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?

if you bypass systemctl then systemd has no way to tell if the service is up or down just by grep.

 

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 | domen.setar@izum.si

 

 



-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------6F07F22ACA8F9261D64C06CF Content-Type: image/png; name="image002.png" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="image002.png" iVBORw0KGgoAAAANSUhEUgAAAAwAAABHCAYAAAAz6qZIAAAAAXNSR0ICQMB9xQAAAAlwSFlz AAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUATWljcm9zb2Z0IE9mZmljZX/tNXEAAAOm SURBVEjH7VZLTBNBGB5MEDXBV4KCiSg9oDUogcTwCBFsEAnysLzaCJTakJU0ZH1s4kY97LIZ YLcv3YNn8aKRxNdFT6AX9Wb0hhcTD/g4eCTigdb5p906bIeyFw8mHL40mZmv/8z3///3L+oW tIuTk5OIBW8teFVrkW6ph1GF13ht3+SttQSnVCCRzcirXELu2ibh3xJcXmPBvunqzV1rGcVK SMLNSJCUavtmWFZO2NdkWTkk6/ouFJKUGvsmD4RQJstqKSrrin0QROVYWFJd+VA/NGPSNxR4 4qkCT8IB4imGQJH8iwQHGULx2dhS4ZnEsqs3sgDquLyReR6K22NLlPDSNLf6wtqgu9943Dam XdZ1fRvv0V4BB6is7KIgq3VVPuNhw4h+W5SVCoRSBdaeKYpFpmkWcSVURGU/kGr8M7NDYa0D obktCCFK5hJgE3RvGJ65AwqVdkU/dozhMFzXdjBVADkBzQtbEysZyalyZd3R99QE4N8g5MiE 5jnabzy3NM9IvApisKWCBsJaL4RkD5J/X24c1uOqrO5jr0l/2YOgNUhrmmIRexDQN65dECRc b2U66R7Qn3SOa5e84zgIRmZHSWdk0SqNJIQniRklh9dF+fnI23QDcZqFh5CIT9FMwxWcELJv KmyNr4iiegDNkWzyQHJjKZRRKZ4i6nyDxufBPWA89QTxDauuEDn8FSo23zV8otoDZUIJULZO 7n7cbzwISWqD48cOTGAfeBMaFfFpJ4SmwJROCe7+yLN0vYMaPMxtITloJK38vSWIFarSno7o lxqfft+OqkHjETn4I+McSUFWqlnXyIfkySHjrpUHWvc8bG+L/QTHaA1OX88mDhY2ysOa0iB+ Wb7uJu2FdGlkG4hYy162VliMiFp7rV+/1xSY0ZsDUxrtaVJ8vz3B6ZsgH48E46CyT3+R463Q 1yT1tbxosizvBHGyHZdBCqwFQguCvoM3lbId1y1gAZzCcumSc9FPkF3WKiHLa4YiqAUSW9Eg u2BoVrR1p2j7GBbB/q1oUDbgr82jeJISiEq/wEdZkiQpleU90TdsNCi+zKMTyRq/Mct7KJQE Gy0zpyPzJOzngz2Rd+BsdhIbjRKc1hBEE2Rch+BBzua0WkrndElndBHun+669dEawteypQH1 BPLlAxiefU5vCJaw6gBplcD5nDwaRgIlsP2aD9AXoqweoXJxJCzLWVPV3XTsOv2Uzhbf5ofu f0qAbzz7Jm+tbQxfgZ7/AwCILqN/OSfGAAAAAElFTkSuQmCC --------------6F07F22ACA8F9261D64C06CF-- --------------B546418B599F614715C53E18--