Description:
Hello, we are using Postgres version 14.9.
According to the official documentation (PostgreSQL - Percona Monitoring and Management) we created a superuser, added a rule in pg_hba.con, we restarted the postgres service, but after the command psql postgres pmm -c “\conninfo” we get the error psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL : Peer authentication failed for user “pmm”
Steps to Reproduce:
- Create a user. This example uses
pmm
. (Replace******
with a strong password of your choice.)
CREATE USER pmm WITH SUPERUSER ENCRYPTED PASSWORD '******';
- PMM must be able to log in locally as this user to the PostgreSQL instance. To enable this, edit the
pg_hba.conf
file. If not already enabled by an existing rule, add:
local all pmm md5
# TYPE DATABASE USER ADDRESS METHOD
- Reload the configuration:
su - postgres
psql -c "select pg_reload_conf()"
And additionaly we run systemctl restart postresql
Version:
Postgres v14.9.
pmm-admin v2.40.0
Expected Result:
“Enter the password for the pmm
user when prompted.”
Actual Result:
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL : Peer authentication failed for user “pmm”
Additional information
\du:
Role name | Attributes | Member of | Description
---------------±-----------------------------------------------------------±-------------±------------
foiv_readonly | | {readaccess} |
foiv_user | | {} |
pmm | Superuser | {} |
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
readaccess | Cannot login | {} |
replication | Replication | {} |
pg_hba.conf:
local all postgres peer
TYPE DATABASE USER ADDRESS METHOD
“local” is for Unix domain socket connections only
local all all peer
IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
IPv6 local connections:
host all all ::1/128 scram-sha-256
Allow replication connections from localhost, by a user with the
replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
host replication replication 10.128.0.27/32 scram-sha-256
host all foiv_user 10.128.0.0/24 md5
host all foiv_readonly 10.128.0.0/24 md5
local all pmm md5