RE: Postgres 10.7 Systemd Startup Issue

From: "Lu, Dan" <Dan(dot)Lu(at)sig(dot)com>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>, "Kelly, Kevin" <Kevin(dot)Kelly(at)sig(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: RE: Postgres 10.7 Systemd Startup Issue
Date: 2019-06-07 13:48:31
Message-ID: d988e6ef234949f79de1c48a569263ec@msx.bala.susq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Even with the added option “—with-systemd”, it is not working still.

Status remains “ Active: activating (start) since Fri 2019-06-07 09:40:06 EDT; 13s ago”.

To outline what I did.

1) Stop PostgreSQL instance running with “/hostname/pg/PostgreSQL-10.7” configuration which was compiled without the “—with-systemd” option

2) Configure PostgreSQL to new location

mkdir /hostname/pg/PostgreSQL-10.7_2

./configure --prefix=/hostname/pg/PostgreSQL-10.7_2

make
make install

mv /hostname/pg/PostgreSQL-10.7 /hostname/pg/PostgreSQL-10.7.OLD

mv /hostname/pg/PostgreSQL-10.7_2 /hostname/pg/PostgreSQL-10.7

3) Start PostgreSQL instance

Any more suggestion?

Dan

From: Lu, Dan
Sent: Friday, June 07, 2019 8:46 AM
To: 'Christopher Browne' <cbbrowne(at)gmail(dot)com>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>; Kelly, Kevin <Kevin(dot)Kelly(at)msx(dot)bala(dot)susq(dot)com>; pgsql-general(at)postgresql(dot)org
Subject: RE: Postgres 10.7 Systemd Startup Issue

Thank you so much for pointing that out.

I downloaded the binary from https://ftp.postgresql.org/pub/source/v10.7

After download, I did the following.

mkdir /hostname/pg/PostgreSQL-10.7_2

./configure --prefix=/hostname/pg/PostgreSQL-10.7_2

make
make install

I now included the option mentioned “./configure --prefix=/hostname/pg/PostgreSQL-10.7_2 --with-systemd”. I also saw that in the documentation now “Using Type=notify requires that the server binary was built with configure --with-systemd.”.

We will reply back if we run into further issue.

Dan
From: Christopher Browne [mailto:cbbrowne(at)gmail(dot)com]
Sent: Thursday, June 06, 2019 9:19 PM
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com<mailto:folarte(at)peoplecall(dot)com>>; Kelly, Kevin <Kevin(dot)Kelly(at)msx(dot)bala(dot)susq(dot)com<mailto:Kevin(dot)Kelly(at)msx(dot)bala(dot)susq(dot)com>>; pgsql-general(at)postgresql(dot)org<mailto:pgsql-general(at)postgresql(dot)org>; Lu, Dan <Dan(dot)Lu(at)msx(dot)bala(dot)susq(dot)com<mailto:Dan(dot)Lu(at)msx(dot)bala(dot)susq(dot)com>>
Subject: Re: Postgres 10.7 Systemd Startup Issue

On Thu, Jun 6, 2019, 8:19 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
Francisco Olarte <folarte(at)peoplecall(dot)com<mailto:folarte(at)peoplecall(dot)com>> writes:
> On Thu, Jun 6, 2019 at 6:57 PM Kelly, Kevin <Kevin(dot)Kelly(at)sig(dot)com<mailto:Kevin(dot)Kelly(at)sig(dot)com>> wrote:
>> We’re attempting to launch postgres via systemd and noticing that when invoking via systemctl start postgres.service the prompt never returns. If we switch to another tty and check the status it shows as:
>> Active: activating (start) since Thu 2019-06-06 09:36:32 EDT; 12min ago
>> If we change the type from notify to forking we see the same behavior. The instance seems to be up and running just fine, we just never see the active (running) status as we have come to expect.

> Are you sure you have the postgres.service correctly configured? ( or
> you could post the ExecStart/Type config, or the whole service file ).

> The type tells systemd how to know the service has finished starting
> and is running, notify means it does systemd integration via socket,
> with IIRC postgres does not.

I might be confusing this with some other issue, but I think PG does
support systemd notification if you build it with the --with-systemd
configuration option. This is recommended if you're using systemd
to launch PG, because systemd's other options for figuring out the
service state work substantially less well.

Yeah, I was one of the reviewers of the patch for this feature.

If the configuration parameter is turned on then Postgres reports in to SystemD once it completes any crash recovery work to indicate that the database service is up.

That way, if there was a bunch of WAL needing to be processed, services depending on Postgres will properly get deferred.

You need to set up the service type in the SystemD service file to
Type=notify
in order to get this behavior

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-06-07 14:03:36 Re: Postgres 10.7 Systemd Startup Issue
Previous Message Tom Lane 2019-06-07 13:41:23 Re: Snowball Stemming Greek support not included in Release 12 beta