Different authentication behaviour when starting postgres from pg_ctl and when starting from systemd
I am running postgres 9.6 cluster on ubuntu 20.
All installation and starting the database is fine, however, I am experiencing a weird behavior.
In the pg_hba.conf file, I am trusting any connection from any user from the local host and it is working just fine when I start the cluster using the "pg_ctl start" utility.
However, when I start it from the systemd, systemctl start [email protected], it fails with the following error
Anyone has proper explanation for this difference in behaviour ?
1 Answer 1
Figured it why; When you use pg_ctl to stop/start your cluster, you define your data directory with -D argument.
However, when you start postgres with systemd 'systemctl stop/start <>', it fetch the configuration (postgresql.conf and pg_hba.conf) from /etc/postgresql/.... according to what is defined in the service definition in systemd.
That is what caused the difference in behaviour.
-
1You should remove the configuration file that is wrong. That way, you will notice automatically if you try to start the server in the wrong way.Laurenz Albe– Laurenz Albe2022年09月01日 15:21:35 +00:00Commented Sep 1, 2022 at 15:21
Explore related questions
See similar questions with these tags.