Dear friends,
i am trying to run a new postgres instance with/on:
Here is the problem: I can run the postmaster directly from my postgres account when i perform the call: $ postmaster -D /mnt/raider/data/postgres/dbaccounting/defTS
$ postmaster -D /mnt/raider/data/postgres/dbaccounting/defTS
But when i try to start the database using systemd-start the invoked postmaster is not able to access the data directory, where the postgres files are located: /mnt/raider/data/postgres/dbaccounting/defTS
When i disable selinux, the server can be started by systemd, so there seems to be a problem with systemd, when it invokes the postmaster. The generated systemd file is using the postgres user, so this should be fine.
Let me show you, how i build the database: **my file system file setting ** 1) chown -R postgres:postgres /mnt/raider/data/postgres 2) semanage fcontext -a -t postgresql_db_t /mnt/raider/data/postgres/dbaccounting/defTS 3) semanage fcontext -a -t postgresql_db_t /mnt/raider/data/postgres/dbaccounting 4) setfattr -n security.selinux -v "system_u:object_r:postgresql_db_t:s0" /mnt/raider/data/postgres/dbaccounting
chown -R postgres:postgres /mnt/raider/data/postgres
semanage fcontext -a -t postgresql_db_t /mnt/raider/data/postgres/dbaccounting/defTS
semanage fcontext -a -t postgresql_db_t /mnt/raider/data/postgres/dbaccounting
setfattr -n security.selinux -v "system_u:object_r:postgresql_db_t:s0" /mnt/raider/data/postgres/dbaccounting
my setting when i create the database 5) semanage port -a -t postgresql_port_t -p tcp 5600 6) firewall-cmd --permanent --add-port=5600/tcp 7) firewall-cmd --add-port=5600/tcp 8) firewall-cmd --reload
semanage port -a -t postgresql_port_t -p tcp 5600
firewall-cmd --permanent --add-port=5600/tcp
firewall-cmd --add-port=5600/tcp
firewall-cmd --reload
then create my database unit 9) postgresql-new-systemd-unit --unit accounting --datadir /mnt/raider/data/postgres/dbaccounting/defTS
postgresql-new-systemd-unit --unit accounting --datadir /mnt/raider/data/postgres/dbaccounting/defTS
the create an initialize a new db 10) postgresql-setup --initdb --unit accounting --port 5600
postgresql-setup --initdb --unit accounting --port 5600
So the systemd-service file was created by the postgresql-new-systemd-unit command and the created service files looks good. The technical user for the database is beeiing set, but for any reasons, the invoked 'postgresql' seems not to have all selinux credentials. Any ideas ?