Re: Can't restart Postgres

From: Shawn Thomas <thomassd(at)u(dot)washington(dot)edu>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can't restart Postgres
Date: 2017-02-15 04:47:16
Message-ID: CF840218-2092-493C-87D8-951864106FE4@u.washington.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

No it doesn’t matter if run with sudo, postgres or even root. Debian actually wraps the command and executes some some initial scripts with different privileges but ends up making sure that Postgres ends up running under the postgres user. I get the same output if run with sudo:

sudo systemctl status postgresql(at)9(dot)4-main(dot)service -l
Error: could not exec start -D /var/lib/postgresql/9.4/main -l /var/log/postgresql/postgresql-9.4-main.log -s -o -c config_file="/etc/postgresql/9.4/main/postgresql.conf”

Thanks, though.

-Shawn

> On Feb 14, 2017, at 5:12 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> On 02/14/2017 05:00 PM, Adrian Klaver wrote:
>> On 02/14/2017 12:00 PM, Shawn Thomas wrote:
>>> Yes that would be the standard approach. But the Debian package removes
>>> pg_ctl from it normal place and wraps it with a perl script in a way
>>> that makes it difficult to work with (it doesn’t accept the same
>>> arguments):
>>>
>>> https://wiki.debian.org/PostgreSql#pg_ctl_replacement
>>>
>>> @Mangnus, can you give me an example of how I might use pg_lsclusters
>>> and pg_ctlcluster? I’ve tried:
>>>
>>
>> I do not see a sudo below or is it apparent whether you are doing this
>> as the postgres user.
>>
>>> pg_ctlcluster 9.4 main start
>>> Error: could not exec start -D /var/lib/postgresql/9.4/main -l
>>> /var/log/postgresql/postgresql-9.4-main.log -s -o -c
>>> config_file="/etc/postgresql/9.4/main/postgresql.conf”
>>
>> Not sure how close Debian 8 is to Ubuntu 16.04(something I use), but
>> from your first post they look like they share the same startup scripts.
>> So something like:
>>
>> sudo systemctl restart postgresql(at)9(dot)4-main(dot)service
> ^^^^^^^
> Should be start
>>
>>
>>>
>>> -Shawn
>>>
>>>> On Feb 14, 2017, at 11:52 AM, Magnus Hagander <magnus(at)hagander(dot)net
>>>> <mailto:magnus(at)hagander(dot)net>> wrote:
>>>>
>>>> On Tue, Feb 14, 2017 at 8:47 PM, Joshua D. Drake <jd(at)commandprompt(dot)com
>>>> <mailto:jd(at)commandprompt(dot)com>> wrote:
>>>>
>>>> On 02/14/2017 11:43 AM, Shawn Thomas wrote:
>>>>
>>>> pangaea:/var/log# systemctl status postgresql
>>>> ● postgresql.service - PostgreSQL RDBMS
>>>> Loaded: loaded (/lib/systemd/system/postgresql.service;
>>>> enabled)
>>>> Active: active (exited) since Tue 2017-02-14 10:48:18 PST;
>>>> 50min ago
>>>> Process: 28668 ExecStart=/bin/true (code=exited,
>>>> status=0/SUCCESS)
>>>> Main PID: 28668 (code=exited, status=0/SUCCESS)
>>>> CGroup: /system.slice/postgresql.service
>>>>
>>>>
>>>> What about if use pg_ctl as the postgres user? That will give you
>>>> a better idea.
>>>>
>>>>
>>>> You don't want ot be doing that on a systemd system, but try a
>>>> combination of pg_lsclusters and pg_ctlcluster. Might be you need to
>>>> shut it down once that way before it realizes it's down,and then start
>>>> it back up.
>>>>
>>>>
>>>> --
>>>> Magnus Hagander
>>>> Me: http://www.hagander.net/
>>>> Work: http://www.redpill-linpro.com/
>>>
>>
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gmail 2017-02-15 05:26:40 Re: Can't restart Postgres
Previous Message Patrick B 2017-02-15 01:29:42 Re: get inserted id from transaction - PG 9.2