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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s