I have updated my pg_hba.conf on the master to this.

host    loko     replicator               trust

and I did reload the configuration. Then I created a user with this command


loko which is the database on my master and replicator as the user.

and running this command on the slave

pg_basebackup -h x.x.x.x -D "C:\Program Files\PostgreSQL\9.4\data" -U 
replicator -v -P --write-recovery-conf -X stream

results in

no pg_hba.conf entry for replication connection from host x.x.x.x. user replicator, SSL off

Thanks a lot for any help. Im new to this so I don't have any idea whats wrong with this. I just followed a tutorial.


1 Answer 1


You have to grant access in replication in pg_hba.conf. Here's the line you should add:

host    replication     replicator               trust

You will find documentation here: https://www.postgresql.org/docs/9.6/static/auth-pg-hba-conf.html

Here's the phrase that explain everything:

The value replication specifies that the record matches if a replication connection is requested (note that replication connections do not specify any particular database).

  • Yes, physical replication in PG 9.x uses WAL streaming. And the WAL contains all changes for all databases in a cluster. Hence specifying a database for the replication connection would make no sense, and that position is used for the replication keyword. I guess this also means you can't have a database called "replication". May 10, 2017 at 14:04
  • Yes you can! (But I don't how you could possibly use that database in pg_hba.conf) postgres=# create database replication; CREATE DATABASE
    – Arkhena
    Nov 22, 2018 at 10:55
  • you would just quote it (ex: "replication"). From the documentation: "Quoting one of the keywords in a database, user, or address field (e.g., all or replication) makes the word lose its special meaning, and just match a database, user, or host with that name." Aug 14, 2020 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.