Postgresql service using a different data directory
aubreys_key at yahoo.com
Sat Feb 9 06:26:50 UTC 2008
Helpful Fedora users,
I would like to have Postgres (as a service) use a different data
directory instead of the default /var/lib/pgsql/data, but I am not sure
how to do this.
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?)
I would like Postgres to use /data/pgsql/data as the data directory
instead of /var/lib/pgsql/data. /data is a RAID array for me and is also
easier to use than selectively backing up parts of /var. The Postgres
documentation does not cover this aspect of the configuration as it is
OS-specific configuration of services. Searching the internet has not been
helpful either. I already reconstructed my database in my desired location
and can access it when explicitly running postgres and specifying the data
directory. However, running postgres as a service defaults to using
/var/lib/pgsql/data, which is not what I want.
I would really appreciate any help and advice on this problem.
Never miss a thing. Make Yahoo your home page.
More information about the fedora-list