RE: pg_ctl can't start db server - Mailing list pgsql-general

From Tanja Savic
Subject RE: pg_ctl can't start db server
Date
Msg-id VI1PR02MB302343B8F14E1BAD3C6CCC5A948A0@VI1PR02MB3023.eurprd02.prod.outlook.com
Whole thread Raw
In response to Re: pg_ctl can't start db server  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_ctl can't start db server  (Paul Förster <paul.foerster@gmail.com>)
Re: pg_ctl can't start db server  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Hi,

@Tom Adding -D in command worked. I just used
pg_ctl start -D [data-directory ]

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@sss.pgh.pa.us>
Sent: Friday, May 29, 2020 5:32 PM
To: Tanja Savic <tanja.savic@crossmasters.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_ctl can't start db server

Tanja Savic <tanja.savic@crossmasters.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
theway 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
witha parameter within postgresql.conf. 

(Note that pg_ctl probably only understands this way, even though theoretically the postmaster can deal with other
approachesto setting up an external config file.) 

            regards, tom lane



pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: How to start slave after pg_basebackup. Why min_wal_size and wal_keep_segments are duplicated
Next
From: Paul Förster
Date:
Subject: Re: Oracle vs. PostgreSQL - a comment