Postgresql – a local replication entry doesn’t work

backuppg-basebackuppg-hba.confpostgresql

Maybe it's just too early in the morning, but I can't seem to get pg_basebackup working for a local user. This is part of testing for an hourly backup automated script. I added a line to pg_hba.conf for this and it looks like:

local     replication      postgres                      trust

But, this entry causes a FATAL error: no pg_hba.conf entry for replication connection from host "[local]", user "postgres", SSL off. What did I screw up? I'll be changing the user once I get this part working. The pg_basebackup command looks like:

pg_basebackup -D - -Ft -z -c fast -l hourly.backup > backup_file.gz

FYI, if I add "-h ", it does work as I do have another pg_hba.conf entry for:

host    replication   postgres   10.10.1.129       md5

Does local not work for replication entries?

(Using PostgreSQL 9.3)

Best Answer

The problem is: "localhost" can be UNIX sockets, IPv4 or IPv6. The first rule you passed is for UNIX sockets. Try to add a rule for IPv4 and one for IPv6. It should work then. Btw, a SIGHUP is enough in case you change pg_hba.conf.