pg_basebackup: could not connect to server: FATAL: no pg_hba.conf entry for replication connection from host "[local]", user "pg_bkp"
While I was trying to take the base backup of postgres cluster using the pg_basebackup I got the below error.
pg_basebackup: could not connect to server: FATAL: no pg_hba.conf entry for replication connection from host “[local]”, user “pg_bkp”
This error is mainly due to the wrong entry in the pg_hba.conf file.
local all pg_bkp trust
I have mentioned the “all” in the DATABASE filed , but this will not allow the replication connection to the database. For taking the backup, pg_basebackup use the replication protocol and create a replication connection. For replication connection we need to explicitly mention the “replication” in the place of “all”.
local replication pg_bkp trust