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 1hYWgU-0004sE-Gp for pgsql-general@arkaria.postgresql.org; Wed, 05 Jun 2019 14:14:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hYWgT-0003Pw-3B for pgsql-general@arkaria.postgresql.org; Wed, 05 Jun 2019 14:14:33 +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 1hYWgR-0003DT-Dl for pgsql-general@lists.postgresql.org; Wed, 05 Jun 2019 14:14:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hYWgN-0007J8-8V for pgsql-general@postgresql.org; Wed, 05 Jun 2019 14:14:30 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 330CD2230F; Wed, 5 Jun 2019 10:14:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 05 Jun 2019 10:14:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=/ Kg1d5urLvmtndVg/RosnjsQ12/fO2OpeokcA83AZ6Q=; b=XXM6xs3mFVtlY17eX zp2205SbnDrqO5P+g6ftOkrhhKBTxbcW1n+eeyrPGp8ZLe0VHlWwsynpE9LURjbm kE16AB9BQtEfZJIriLpPit30wX/P5Qxn6EUrN91jHLY67ZCyi9LtwimxtfPwepZq T9cMVNhjeeC8X4R94ILeMaSwCexTKLRaLWQpYn46QuXEph1lKVR+2ChMBDJileyV R6AgIsJ6fzy67sglyjUkpK1EG0O39bkk4/ssJw0L2e78X8yiAcY7IbqXBh5DKbGC L2u6mUPtiyhYT8F7spbGbl9LCNPFXps+vLITfzZU8LD+DiwdzLDVnB0gHDMs5t3O 0nrFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=/Kg1d5urLvmtndVg/RosnjsQ12/fO2OpeokcA83AZ 6Q=; b=ko9jvr7bPUf9gGCVgZ5EKQE0tt4c7tTNqEep+apa8+Ux9diSaQwSwkVTk 7p7lbahyTdZJ40WW+koG8mFHsTxUzKTn3x3tR8kQA73FQ+5PPdaB6pw9cl6xXhIY HGhGlx7E4GXblv5wp5Cqgs2NZ3OQ7T2grHfYBpdVnAMM7KpAvifjx6POt0dQEIGe rTMJMzDi1P5fn+RC1pV5jA/xJthnco8wc2GVZpuvOakvrAx6XV31sTH5MWWWjAsL tTpbKMzziAl6Sl/kCi3N5xOTzW0JQBNZ31+rlecF2QKGEIEUB+ECnc5HfIIn46/Q p3jq3dyMtbFWXjJ8PiX+mlw2KGArw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudegvddgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdhiiihumhdrshhinecu kfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomheprg gurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhi iigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 09A6D380073; Wed, 5 Jun 2019 10:14:24 -0400 (EDT) Subject: Re: Postgresql-11 confusing situtation To: =?UTF-8?Q?Domen_=c5=a0etar?= , "pgsql-general@postgresql.org" References: <1712870b1d2a457f975645383a2e0f9a@izum.si> From: Adrian Klaver Message-ID: Date: Wed, 5 Jun 2019 07:14:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <1712870b1d2a457f975645383a2e0f9a@izum.si> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 > |domen.setar@izum.si > -- Adrian Klaver adrian.klaver@aklaver.com