@@ -6,9 +6,19 @@ gosu postgres postgres --single template1 <<- EOSQL
6
6
CREATE EXTENSION pgpool_adm
7
7
EOSQL
8
8
9
- gosu postgres postgres --single -jE << -EOSQL
10
- CREATE USER "$REPLICATION_USER " REPLICATION LOGIN ENCRYPTED PASSWORD $REPLICATION_PASSWORD ;
11
- EOSQL
9
+ cat > " $PGDATA " /pg_hba.conf << EOS
10
+ # TYPE DATABASE USER ADDRESS METHOD
11
+ # "local" is for Unix domain socket connections only
12
+ local all all trust
13
+ # IPv4 local connections:
14
+ host all all 127.0.0.1/32 trust
15
+ # IPv6 local connections:
16
+ host all all ::1/128 trust
17
+
18
+ # Allow anyone to connect remotely so long as they have a valid username and
19
+ # password.
20
+ host all all 0.0.0.0/0 md5
21
+ EOS
12
22
13
23
# postgresql.conf
14
24
{ echo ; echo " wal_level = hot_standby" ; } >> " $PGDATA " /postgresql.conf
@@ -19,15 +29,14 @@ EOSQL
19
29
{ echo ; echo " local replication postgres trust" ; } >> " $PGDATA " /pg_hba.conf
20
30
{ echo ; echo " host replication \" $REPLICATION_USER \" 0.0.0.0/0 md5" ; } >> " $PGDATA " /pg_hba.conf
21
31
32
+ gosu postgres postgres --single -jE << -EOSQL
33
+ CREATE USER "$REPLICATION_USER " REPLICATION LOGIN ENCRYPTED PASSWORD '$REPLICATION_PASSWORD ';
34
+ SELECT * FROM pg_create_physical_replication_slot('$REPLICATION_SLOT ');
35
+ EOSQL
36
+
22
37
23
38
24
39
# # Specifies a trigger file whose presence should cause streaming replication to
25
40
# # end (i.e., failover).
26
41
# trigger_file = '/tmp/pg_failover'
27
- #
28
- # # Specifies a command to load archive segments from the WAL archive. If
29
- # # wal_keep_segments is a high enough number to retain the WAL segments
30
- # # required for the standby server, this may not be necessary. But
31
- # # a large workload can cause segments to be recycled before the standby
32
- # # is fully synchronized, requiring you to start again from a new base backup.
33
- # #restore_command = 'cp /path_to/archive/%%f "%%p"'
42
+ #
0 commit comments