Configuring pgpool-II 4.4 but pcp_recovery_node can't connect

Hi everyone,

I followed this documentation https://www.pgpool.net/docs/44/en/html/example-cluster.html to setup pgpool in my PostgreSQL cluster.

Everything seems to be working as expected, at least the virtual IP is being delegated to the master node after I started the pgpool.

When I try to execute this step:

 pcp_recovery_node -h 172.28.0.224 -p 9898 -U pgpool -n 1

I’m getting this error message:

FATAL:  authentication failed for user "pgpool"
DETAIL:  username and/or password does not match

This is my pool_hba.conf

# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust
host    all         pgpool           0.0.0.0/0          scram-sha-256
host    all         postgres         0.0.0.0/0          scram-sha-256

This is my pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
host	all		postgres	0.0.0.0/0		scram-sha-256
host	all		all		0.0.0.0/0		md5

# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident
host	replication	repl		172.28.0.225/32		scram-sha-256
host	replication	repl		172.28.0.226/32		scram-sha-256

And have configured pcp.conf and pool_passwd

drwxr-xr-x.  3 root     root      4096 jan 16 23:47 .
drwxr-xr-x. 82 root     root      4096 jan 16 23:16 ..
-rwxr-xr-x.  1 postgres postgres   638 jan 16 23:26 escalation.sh
-rwxr-xr-x.  1 postgres postgres  2772 jan 16 22:59 failover.sh
-rwxr-xr-x.  1 postgres postgres  6974 jan 16 23:01 follow_primary.sh
-rw-------.  1 postgres postgres   898 jan 16 23:02 pcp.conf
-rw-------.  1 postgres postgres   858 dez 22 11:03 pcp.conf.sample
-rw-------.  1 postgres postgres 53183 jan 16 23:47 pgpool.conf
-rw-------.  1 postgres postgres 52964 dez 22 11:03 pgpool.conf.sample
-rw-------.  1 postgres postgres     3 jan 16 22:45 pgpool_node_id
-rw-------.  1 postgres postgres  3617 jan 16 23:11 pool_hba.conf
-rw-------.  1 postgres postgres  3476 dez 22 11:03 pool_hba.conf.sample
-rw-------.  1 postgres postgres    92 jan 16 23:13 pool_passwd
drwxr-xr-x.  2 root     root      4096 jan 16 22:11 sample_scripts

Any clues?

Best regards,

possebon

1 Like

The error suggests that the PCP user/password is not correct. Other than providing the wrong user/password combination, this could happen when “pcp.conf” file does not contain the ‘user: password’ in the correct format (see Configuring pcp.conf for details) or pcp.conf file is not picked up by pgpool. Note: you can also provide the pcp.conf to pgpool using ‘–pcp-file’ or -F command line arguments.

Regards
Muhammad Usama

1 Like

Hi Muhammad, thanks for your reply.

I checked the pcp.conf and it has the user and the password on it. One thing that sounds strange to me is that I set the password of pgpool with scram-sha-256 (as documentation) and on pcp.conf it’s a MD5 hash of password.

Regards,

Fernando Possebon

1 Like

Scram only works for PG connections (between Client <-> pgpool and pgpool <-> PostgreSQL), while PCP only supports md5 authentication. PCP users differ from PostgreSQL users and don’t need to be created in the PG database. The ‘username: password’ for PCP only needs to be listed in pcp.conf, and that doesn’t require any configuration in pool_hba, pg_hba, or pool_passwd files

1 Like