hapostgres / pg_auto_failover

Postgres extension and service for automated failover and high-availability
Other
1.07k stars 112 forks source link

"pg_autoctl create monitor" fails with multiple errors #982

Closed jerebear12 closed 1 year ago

jerebear12 commented 1 year ago

Behavior

pg_autoctl create monitor is failing for me on Ubuntu 22.0.4 with multiple errors.

Context

I was able to install postgres version 15 without having the 15/main directory created, however the commands the docs list wouldn't work without adding sudo before most of them. I then ran sudo apt-get install pg-auto-failover-cli and sudo apt-get install postgresql-15-auto-failover just like the docs instruct.

Next I created a new directory named monitor at /var/lib/postgres.

I get these same or similar errors when I don't go through the process to install postgres without the 15/main directory.

The Issue

I proceeded to run: pg_autoctl create monitor --pgdata /var/lib/postgresql/monitor --pgport 9700 --hostname 10.0.2.4 --ssl-self-signed --auth trust Which failed with many errors(usually I screenshot info like this but there's too much to fit in one image): logs-1.txt Using sudo to try to bypass the could not create lock file error: logs-2.txt

I would greatly appreciate any help/pointers!

DimCitus commented 1 year ago

It seems that while you're using debian / Ubuntu and their Postgres packaging, you are also using a system user that is not in the postgres system group, as per:

15:23:34 4017 FATAL 2023-02-22 15:23:24.315 CST [4033] FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.9700.lock": Permission denied

Please consider adding your user to the postgres group on the OS.