Good Morning all, I have an HA setup consisting of 2 Postgres servers with pgpool on top of them. The setup is working fine. I am trying to replicate data of this cluster to a third Postgres server(outside the current cluster) using the pg_basebackup command for the same. When I provided pg_basebackup with the master Postgres IP it worked fine and data was replicated to the third server.
Now, I am trying to perform the same activity but this time, instead of providing the IP for the master Postgres I am providing the pgpool IP to the pg_basebackup command and received the following errors.
On the master Postgres server logs
LOG: could not receive data from client: Connection reset by peer
ERROR: cannot execute SQL commands in WAL sender for physical replication
On the Postgres server from where pg_basebackup is executed
pg_basebackup: could not send replication command "SHOW data_directory_mode": FATAL: Backend throw an error message
DETAIL: Exiting current session because of an error from backend
HINT: BACKEND Error: "cannot execute SQL commands in WAL sender for physical replication"
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Note: Pgpool is configured in a way that all the read/write requests are directed only to the master postgres server and I am using streaming replication with pg_basebackup.