Specifying an Alternative PostgreSQL Data Directory
The default data directory for PostgreSQL 9.5 is
/var/lib/pgsql/9.5/data. If you do not need to change the directory, skip this topic.
![]() | Important The steps below use the example alternative directory in the following steps is
/external-vol/pgdata-9.5.
|
-
Complete one of the following based on the version of Red Hat EL.
- Red Hat EL 6:
- Create and edit /etc/sysconfig/pgsql/postgresql-9.5.
- Add the following line then save and close the file:
PGDATA=/external-vol/pgdata-9.5
- Red Hat EL 7:
- Create and edit /etc/systemd/system/postgresql-9.5.service.
- Add the following content:
.include /lib/systemd/system/postgresql-9.5.service [Service] Environment=PGDATA=/external-vol/pgdata-9.5
- Red Hat EL 6:
- Set the PGDATA environment variable to point to the custom data directory. This is necessary for the Xpress Insight Server installer to find the custom data directory: export PGDATA="/external-vol/pgdata-9.5"