BUG #12801: data_directory postgresql.conf setting is not honored on Centos 6.6

From: kyle(dot)sletmoe(at)elementaltechnologies(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12801: data_directory postgresql.conf setting is not honored on Centos 6.6
Date: 2015-02-24 22:52:35
Message-ID: 20150224225235.2529.87182@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12801
Logged by: Kyle Sletmoe
Email address: kyle(dot)sletmoe(at)elementaltechnologies(dot)com
PostgreSQL version: 9.3.6
Operating system: Centos 6.6
Description:

According to
http://www.postgresql.org/docs/9.3/static/runtime-config-file-locations.html,
I should be able to put my configuration files (postgresql.conf,
pg_hba.conf, pg_ident.conf) in a different directory than my data directory,
as long as I set the PGDATA environment variable to the directory that
contains postgresql.conf and then set the data_directory variable in
postgresql.conf to point to the directory that actually contains the
postgres data. To configure this, I did a fresh install of PostgreSQL 9.3.6
on a Centos 6.5 (x64) machine, following the instructions here:
https://wiki.postgresql.org/wiki/YUM_Installation. I created a directory for
the data ('/data/pgsql/data') and one for configuration
('/data/pgsql/config'). I then ran `su postgres -c
'/usr/pgsql-9.3/bin/initdb -D /data/pgsql/data'`, and then moved the .conf
files out of /data/pgsql/data into /data/pgsql/config. I then modified
postgresql.conf, setting "data_directory = '/data/pgsql/data'", "pg_file =
'/data/pgsql/config/pg_hba.conf'", and "ident_file =
'/data/pgsql/config/pg_ident.conf'". Lastly, I updated
/etc/sysconfig/pgsql/postgresql-9.3 to include "export
PGDATA=/data/pgsql/config". When I ran `sudo service postgresql-9.3 start`,
I got this error message: '/data/pgsql/config is missing. Use "service
postgresql-9.3 initdb" to initialize the cluster first.'. I looked at the
postgres init script ('/etc/init.d/postgresql-9.3') and noticed this message
will be emitted if this bash statement results in false: "if [ -f
"$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]". $PGDATA in this context is
config directory like we set above in the
/etc/sysconfig/pgsql/postgresql-9.3 file. The init script needs to check the
value of data_directory in postgresql.conf in order to see if the data in
the data directory is valid.

Browse pgsql-bugs by date

  From Date Subject
Next Message gis.dur 2015-02-25 05:30:52 BUG #12802: Error running loadmodules.vbs while installation
Previous Message David Steele 2015-02-24 05:32:30 Re: View restore error in 9.3-9.4 upgrade