Skip to content

Commit 3867463

Browse files
Update replication.md
1 parent 0b2ae5e commit 3867463

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

replication.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,7 @@ pg_basebackup -h 192.168.0.28 -U replicator -p 5432 -D $PGDATA -P -Xs -R
102102
pg_basebackup: error: directory "/var/lib/pgsql/12/data" exists but is not empty
103103
```
104104

105-
Create a recovery command file in the standby server; the following parameters are required for streaming replication.
106105

107-
$ $EDITOR recovery.conf
108-
```
109-
# Note that recovery.conf must be in $PGDATA directory.
110-
# It should NOT be located in the same directory as postgresql.conf
111-
112-
# Specifies whether to start the server as a standby. In streaming replication,
113-
# this parameter must to be set to on.
114-
standby_mode = 'on'
115-
116-
# Specifies a connection string which is used for the standby server to connect
117-
# with the primary.
118-
primary_conninfo = 'host=192.168.0.10 port=5432 user=replication password=password'
119-
120-
# Specifies a trigger file whose presence should cause streaming replication to
121-
# end (i.e., failover).
122-
trigger_file = '/path_to/trigger'
123-
124-
# Specifies a command to load archive segments from the WAL archive. If
125-
# wal_keep_segments is a high enough number to retain the WAL segments
126-
# required for the standby server, this may not be necessary. But
127-
# a large workload can cause segments to be recycled before the standby
128-
# is fully synchronized, requiring you to start again from a new base backup.
129-
restore_command = 'cp /path_to/archive/%f "%p"'
130-
```
131106

132107
Start postgres in the standby server. It will start streaming replication.
133108

@@ -158,15 +133,3 @@ postgres=# select * from pg_stat_wal_receiver;
158133
```
159134

160135

161-
### How to do failover
162-
163-
Create the trigger file in the standby after the primary fails.
164-
165-
How to stop the primary or the standby server
166-
167-
Shut down it as usual (pg_ctl stop).
168-
169-
How to restart streaming replication after failover
170-
171-
Repeat the operations from 6th; making a fresh backup, some configurations and starting the original primary as the standby. The primary server doesn't
172-
need to be stopped during these operations.

0 commit comments

Comments
 (0)