Search Postgresql Archives

Re: Server tries to read a different config file than it is supposed to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/23/2015 04:23 AM, twoflower wrote:
I thought I understood how specifying a config file path for the server
works, but that's apparently not the case.

The cluster data is at */storage/postgresql/9.4/data*.

The config files are at */etc/postgresql/9.4/main* (this is the default
location on Ubuntu).

This is how the beginning of */etc/postgresql/9.4/main/postgresql.conf*
looks like:

|data_directory = '/storage/postgresql/9.4/data'
hba_file = '/etc/postgresql/9.4/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.4/main/pg_ident.conf' |

So I wrote a few scripts to make my life easier, e.g. *pg94start.sh*:

|su postgres -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D
/storage/postgresql/9.4/data -o '-c
config_file=/etc/postgresql/9.4/main/postgresql.conf'"|

But running this script did not work, the server would not start. So I
checked the log file and there was:

*FATAL: could not open file
"/storage/postgresql/9.4/data/postgresql.conf": Permission denied*

After fixing the ownership of this file, it worked.

What's the reason the server was trying to access that file? Why does
not the override given by the *|config_file|* parameter work?

I think you are seeing the effects of the below:

http://www.postgresql.org/docs/9.4/static/runtime-config-file-locations.html

"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. Notice that data_directory overrides -D and PGDATA for the location of the data directory, but not for the location of the configuration files."


By specifying -D you pointing at /storage/postgresql/9.4/data as the source for the conf files, then changing that with the -o switch. Try your command without the -D switch and let the postgresql.conf file in
/etc/postgresql/9.4/main/ provide the data_directory.



Thank you.
------------------------------------------------------------------------
View this message in context: Server tries to read a different config
file than it is supposed to
<http://postgresql.nabble.com/Server-tries-to-read-a-different-config-file-than-it-is-supposed-to-tp5850752.html>
Sent from the PostgreSQL - general mailing list archive
<http://postgresql.nabble.com/PostgreSQL-general-f1843780.html> at
Nabble.com.


--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux