Обсуждение: pg_ctl -w with postgresql.conf in non-default path

Поиск
Список
Период
Сортировка

pg_ctl -w with postgresql.conf in non-default path

От
Дата:
Hello guys,

This is my first post to this list..

I'm using PostgreSQL8.3.3 and I moved postgresql.conf to the
outside of DATA direcotory, and invoked postgres via pg_ctl
as following.

pg_ctl -w -D /data -o '--config-file=/home/hirano/postgresql.conf' start

This seems to work well, but when I changed the port parameter in
that postgresql.conf, pg_ctl waits for timeout by "-w" option.
In this case, postgres correctly listens the port I wrote in
config, but pg_ctl checkes the port in the data/postgresql.conf
file.

I think this is because the path to postgresql.conf is hard-coded
in the pg_ctl.c

| snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);

But actually there're no descriptions of --config-file option in the
manual of postgres command, although I'm not sure how I could
find it...

Is it bad way to use --config-file option or pg_ctl bug?

Regards.

-- 
HIRANO Yoshitaka







Re: pg_ctl -w with postgresql.conf in non-default path

От
Andrew Dunstan
Дата:

yo@hirano.cc wrote:
> Hello guys,
>
> This is my first post to this list..
>
> I'm using PostgreSQL8.3.3 and I moved postgresql.conf to the
> outside of DATA direcotory, and invoked postgres via pg_ctl
> as following.
>
> pg_ctl -w -D /data -o '--config-file=/home/hirano/postgresql.conf' start
>
> This seems to work well, but when I changed the port parameter in
> that postgresql.conf, pg_ctl waits for timeout by "-w" option.
> In this case, postgres correctly listens the port I wrote in
> config, but pg_ctl checkes the port in the data/postgresql.conf
> file.
>
> I think this is because the path to postgresql.conf is hard-coded
> in the pg_ctl.c
>
> | snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
>
> But actually there're no descriptions of --config-file option in the
> manual of postgres command, although I'm not sure how I could
> find it...
>
> Is it bad way to use --config-file option or pg_ctl bug?
>
>
>   

Try setting the port for pg_ctl: PGPORT=nnn pg_ctl -D datadir -w start

cheers

andrew


Re: pg_ctl -w with postgresql.conf in non-default path

От
HIRANO Yoshitaka
Дата:
From: Andrew Dunstan <andrew@dunslane.net>
Subject: Re: [HACKERS] pg_ctl -w with postgresql.conf in non-default path
Date: Mon, 07 Jul 2008 09:07:14 -0400

> Try setting the port for pg_ctl: PGPORT=nnn pg_ctl -D datadir -w start

Thank you, andrew, I understand what I did was not right way to specify the port.
And finally i found the way to specify the path of postgresql.conf file
in the manual 18.2.

| If you wish to keep the configuration files elsewhere than the data directory,
| the postgres -D command-line option or PGDATA environment variable must point
| to the directory containing the configuration files, and the data_directory
| parameter must be set in postgresql.conf (or on the command line) to show
| where the data directory is actually located.

This is very complicated and not intuitive way but I understand in this case
pg_ctl.c works well.

Regards.

-- 
HIRANO Yoshitaka