1

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

host    loko     replicator      10.0.2.15/32               trust

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

 CREATE USER replicator REPLICATION LOGIN ENCRYPTED PASSWORD 'repl'

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.

3

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

host    replication     replicator      10.0.2.15/32               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". – Colin 't Hart May 10 '17 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 '18 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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