Modifying the data directory location v16
On RHEL/Rocky Linux/AlmaLinux 8.x | 9.x
On a RHEL/Rocky Linux/AlmaLinux 8.x or 9.x host, the unit file is named edb-as-<xx>.service
, where <xx>
is the EDB Postgres Advanced Server version. It resides in /usr/lib/systemd/system
. The unit file contains references to the location of the EDB Postgres Advanced Server data
directory. Avoid making any modifications directly to the unit file because they might be overwritten during package upgrades.
By default, data files reside under the /var/lib/edb/as16/data
directory. To use a data directory that resides in a nondefault location:
Create a copy of the unit file under the
/etc
directory:In the
/etc/systemd/system/edb-as-15.service
file, update the following values with the new location of the data directory:Go to bin directory and initialize the cluster with the new location:
Start the EDB Postgres Advanced Server service:
Configuring SELinux policy to change the data directory location on RHEL/Rocky Linux/AlmaLinux 8.x | 9.x
By default, the data files reside under the /var/lib/edb/as16/data
directory. To change the default data directory location depending on individual environment preferences, you must configure the SELinux policy:
Stop the server:
Check the status of SELinux using the
getenforce
orsestatus
command:View the SELinux context of the default database location:
Create a directory for a new location of the database:
Move the data directory to
/opt/edb
:Create a file
edb-as-16.service
under/etc/systemd/system
to include the location of a new data directory:Use the semanage utility to set the context mapping for
/opt/edb/
. The mapping is written to the/etc/selinux/targeted/contexts/files/file.contexts.local
file.Apply the context mapping using the restorecon utility:
Reload systemd to modify the service script:
With the
/opt/edb
location labeled correctly with the context, start the service: