moving postgresql.conf: pg_ctl can't find postmaster.pid anymore

From: Ludo Smissaert <ludo(at)ludikidee(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: moving postgresql.conf: pg_ctl can't find postmaster.pid anymore
Date: 2009-11-02 14:59:48
Message-ID: 4AEEF3E4.1060900@ludikidee.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

The Postgresql configuration files can be kept elsewhere than the data
directory, as is described in the section about "File Locations."
(18.2 of as of 8.4)[1]

The documentation here basically mentions two ways of doing this.

First you can start Postgresql with the -D option to pg_ctl pointing to
the configuration files(/etc/postgresql for example), and then specify
the data cluster directory (/var/postgresql/data for example) inside
postgresql.conf.

$ pg_ctl -D /etc/postgresql -l .../logfile start

The second way is starting postgresql with the `config_file` parameter
passed to the postgres process via the -c option of the postgres
command, then specify each file individually inside postgresql.conf.

$ pg_ctl -o "-c config_file='/etc/postgresql/postgresql.conf'" \
-l .../logfile start

Both methods works fine on server startup, but the first method gives
problems when stopping the server with pg_ctl.

The problem I found is that pg_ctl expected the file 'postmaster.pid'
inside the configuration directory passed to with -D (/etc/postgresql),
but postgres created it in the data cluster directory as specified
inside postgresql.conf (/var/postgresql/data).

I could fake pg_ctl with -D pointing to the data cluster
directory, not to the configuration directory. Then it worked fine. But
I feel this is not the right way of doing things.

As I understand, `external_pid_file`, has nothing to do with this: it is
an *extra* pid file, not the one needed by pg_ctl.

Any comments on this are very welcome.

Thank you all and have a very nice day/night :)

Ludo

--
[1]
http://www.postgresql.org/docs/8.4/static/runtime-config-file-locations.html

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2009-11-02 15:04:56 Re: How can I know ./configure options for binary installation
Previous Message wstrzalka 2009-11-02 14:36:58 How can I know ./configure options for binary installation