0

We have centos7, postgresql15, all required modules, configs are fine I cant run patroni as postgres user When i change patroni.service USER= and GROUP= to root, its runs well But if i change it to postgres It shows error in log:

Failed to import patroni.dcs.consul|etcd|etcd| etc...

Deleting python3 and all modules & packages didnt help It seems that patroni cant reach python modules, so i changed permissions 755 *site-packages/ But it changed nothing, what permission patroni need to run service as postgres?

preinstalled whole cluster haproxy,etcd,postgresql on a fresh servers and everything runs smooth, but on old prod servers i met this trouble

Jan
  • 3
  • 1

1 Answers1

-1

It seems like you have a permissions issue when trying to run Patroni with your user. Here are a few steps to troubleshoot and resolve the issue:

  1. Verify the correct Python environment being used by the "postgres" user.
  2. Make sure the required modules are installed for the "postgres" user's Python environment. -> Use this: sudo -u postgres pip3 install --user patroni[etcd]
  3. Check the permissions of the site-packages directory and its contents.
  4. If you're using CentOS 7, it's possible that SELinux is blocking access to certain files or directories. To check if this is the case, temporarily set SELinux to permissive mode by running sudo setenforce 0. If Patroni runs without issues in permissive mode, you'll need to adjust your SELinux policies to allow Patroni to access the required files and directories.
  5. Make sure the Patroni service file is correctly configured to run as the "postgres" user. The service file should include the following lines: User=postgres Group=postgres

After making these changes, restart the Patroni service and Inspect logs for additional information

  • > Use this: sudo -u postgres pip3 install --user patroni[etcd] this actually helped me thank you vm! – Jan Apr 12 '23 at 12:32