Re: pg_ctl can't start db server

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tanja Savic <tanja(dot)savic(at)crossmasters(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_ctl can't start db server
Date: 2020-06-01 13:26:31
Message-ID: d9636397-c989-71be-ac75-6510065fd78a@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/1/20 12:04 AM, Tanja Savic wrote:
> Hi,
>
> @Tom Adding -D in command worked. I just used
> pg_ctl start -D [data-directory ]

You would be better off using the tools provided to manage clusters with
the Ubuntu/Debian packaging:

https://wiki.debian.org/PostgreSql

So as I mentioned previously:

sudo pg_ctlcluster 12 main stop

sudo pg_ctlcluster 12 main start

The wrapper script that drives the above takes care of the below.

>
> PGDATA was not set permanently although I tried to set it (with postgres user):
> export PGDATA=" /var/lib/postgresql/12/main"
>
> @Adrian It's Ubuntu and output of pg_lsclusters was this:
> 12 main 24538 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
>
> Thank you for your replies.
> BR,
> Tanja
>
> -----Original Message-----
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Sent: Friday, May 29, 2020 5:32 PM
> To: Tanja Savic <tanja(dot)savic(at)crossmasters(dot)com>
> Cc: pgsql-general(at)lists(dot)postgresql(dot)org
> Subject: Re: pg_ctl can't start db server
>
> Tanja Savic <tanja(dot)savic(at)crossmasters(dot)com> writes:
>> The configuration file path is /etc/postgresql/12/main/ postgresql.conf and it is configured in /var/lib/postgresql/12/main/postmaster.opts:
>
>> "/usr/lib/postgresql/12/bin/postgres "-D" "/var/lib/postgresql/12/main" "-c" "config_file=/etc/postgresql/12/main/postgresql.conf"
>
>> Why does pg_ctl complains about the postgresql.conf path?
>
> I don't remember the exact interaction between -D and an explicit config_file setting, but evidently it's not working the way you wish.
> See
>
> https://www.postgresql.org/docs/current/runtime-config-file-locations.html
>
> which suggests that you should use -D to point at the directory where postgresql.conf is, and set the data directory with a parameter within postgresql.conf.
>
> (Note that pg_ctl probably only understands this way, even though theoretically the postmaster can deal with other approaches to setting up an external config file.)
>
> regards, tom lane
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-06-01 13:43:32 Re: Trigger not firing
Previous Message Ravi Krishna 2020-06-01 11:58:36 Re: Oracle vs. PostgreSQL - a comment