Skip to content

Commit a937b07

Browse files
committed
Add example for replication in pg_hba.conf
Selena Deckelmann
1 parent 74aaa21 commit a937b07

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/backend/libpq/pg_hba.conf.sample

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
# plain TCP/IP socket.
2323
#
2424
# DATABASE can be "all", "sameuser", "samerole", "replication", a
25-
# database name, or a comma-separated list thereof.
25+
# database name, or a comma-separated list thereof. The "all"
26+
# keyword does not match "replication". Access to replication
27+
# must be enabled in a separate record (see example below).
2628
#
2729
# USER can be "all", a user name, a group name prefixed with "+", or a
2830
# comma-separated list thereof. In both the DATABASE and USER fields
@@ -80,3 +82,7 @@
8082
host all all 127.0.0.1/32 @authmethod@
8183
# IPv6 local connections:
8284
host all all ::1/128 @authmethod@
85+
# Allow replication connections from localhost, by a user with the
86+
# replication privilege.
87+
# host replication @default_username@ 127.0.0.1/32 @authmethod@
88+
# host replication @default_username@ ::1/128 @authmethod@

src/bin/initdb/initdb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,11 @@ setup_config(void)
10861086
"@authcomment@",
10871087
strcmp(authmethod, "trust") ? "" : AUTHTRUST_WARNING);
10881088

1089+
/* Replace username for replication */
1090+
conflines = replace_token(conflines,
1091+
"@default_username@",
1092+
username);
1093+
10891094
snprintf(path, sizeof(path), "%s/pg_hba.conf", pg_data);
10901095

10911096
writefile(path, conflines);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy