Moving the data directory for systemd service startup

From: Evan Rempel <erempel(at)uvic(dot)ca>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Moving the data directory for systemd service startup
Date: 2018-07-23 17:19:31
Message-ID: 56130215-3c42-69cd-2d01-6f8aea6da46a@uvic.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I am using the official RPMs for RHEL-7 and am having difficulty in using a different database directory than the
default of

/var/lib/pgsql/9.6/data/
or
/var/lib/pgsql/10/data/

It is easy to modify the service file

/usr/lib/systemd/system/postgresql-9.6.service

with the line

Environment=PGDATA=/var/lib/pgsql/9.6/data/

to point to the location I want, but an RPM update will replace this file and break database startup.

I was hoping that there would be a line

EnvironmentFile=-/etc/sysconfig/pgsql/postgresql-9.6

or

EnvironmentFile=-/etc/sysconfig/pgsql/postgresql-10

to allow for customization of the environment variables, similar to the init.d startup, but I don't see one.

Am I missing something, or is the configuration of the systemd unit file an oversight?

Any information would be helpful.

Evan.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2018-07-23 17:23:38 Re: Upgrade postgresql from 9.1 to 9.6
Previous Message Sohel Tamboli 2018-07-23 17:14:44 Upgrade postgresql from 9.1 to 9.6