You are not logged in.

#1 2017-05-27 23:33:10

vanbeast
Member
Registered: 2011-10-07
Posts: 4

Change data directory for Postgresl

Hi!
I have installed postgresql package (9.6.3-1). Now I want to change default directory for the database cluster. This command works ok:

initdb --locale $LANG -E UTF8 -D '/my/directory/here/data'

To make postgresql my custom database cluster directory I override PGROOT variable in /etc/systemd/system/postgresql.service.d/pgdata.conf :

[Service]
# Location of database directory
Environment=PGROOT=/my/directory/here

But postgresql doesn't start, because it can't find pid file. I checked postgresql.service file and found that PGROOT variable is not used in PIDFile variable.
I replaced line #14 with:

PIDFile=${PGROOT}/data/postmaster.pid

Is it problem with service file? Or should I change database cluster directory in another way?

Offline

Board footer

Powered by FluxBB