i am trying to run a new postgres instance with/on:
a mounted raid drive
a separate process managed by an individual systemd-service
with its on listener port
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
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 **
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
then create my database unit
9) 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
I think you remembered more of the SELinux moving parts than I would have done.
Looking at your list, I would double check the permissions on /mnt, /mnt/raider, and /mnt/raider/data - make sure that everyone has at least execute permission on those directories (chmod o+x ...).
If it’s still not starting after that, it might be worth putting SELinux in permissive mode (rather than disabling it) and looking at the logs to see what errors are generated.
i can not use the default, because they are already in use, including the port number. Besides i have an older version running also on Fedora, that works exactly like this i described above!
as i wrote, the manual start of the postmaster (using the postgres account) does work. So the permission for postgres should be fine. The question is, why the systemd is not capable to start the postmaster in the same way id did (manually).
thank you all for your hints and ideas. In the meantime i was able to unterstand and fix that issue.
The problem was related to selinux and i found out, that the mount-point to the file-systems that
held one services was missing a selinux tag.
Now it looks like this and it is running perfectly: