HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Postresql replication pg_basebackup no pg_hbaconf entry for replication connection

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
entrypostresqlreplicationpg_basebackuppg_hbaconfforconnection

Problem

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.

Solution

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).

Code Snippets

host    replication     replicator      10.0.2.15/32               trust

Context

StackExchange Database Administrators Q#173157, answer score: 7

Revisions (0)

No revisions yet.