Postgresql service using a different data directory
Gordon Messmer
yinyang at eburg.com
Sat Feb 9 10:00:56 UTC 2008
Aubrey Barnard wrote:
> Is there a way to have Postgres use a different data directory short of
> editing /etc/rc.d/init.d/postgresql and changing the default setting of
> PGDATA? I noticed that /etc/rc.d/init.c/postgresql looks to files in
> /etc/sysconfig/pgsql, but I don't have any files there to guide
> editing/additions and I cannot find documentation on the subject. However,
> I presume adding a file to /etc/sysconfig/pgsql is the best way to go. Can
> someone confirm and explain this? (E.g. would I also need to specify
> PGLOG? Is it important to back up the log?)
>
All that you need to do is edit /etc/sysconfig/pgsql/postgresql and add
one line:
PGDATA=/data/pgsql
That's it. You don't need to worry about the log.
The init script itself will be overwritten by updates, so you don't want
to modify that. The file in /etc/sysconfig/pgsql won't be.
More information about the fedora-list
mailing list