@@ -11,44 +11,53 @@ if [[ "${WALG_BASE_BACKUP_NAME:-0}" != "0" ]]; then
11
11
wal-g backup-fetch $PGDATA $WALG_BASE_BACKUP_NAME
12
12
fi
13
13
14
- # # ****************** Recovery config 11 **************************
15
- # touch /tmp/recovery.conf
16
- # echo "restore_command = 'wal-g wal-fetch %f %p'" >>/tmp/recovery.conf
17
- # echo "standby_mode = on" >>/tmp/recovery.conf
18
- # echo "trigger_file = '/run_scripts/tmp/pg-failover-trigger'" >>/tmp/recovery.conf # [ name whose presence ends recovery]
19
- # #echo "recovery_target_timeline = 'latest'" >>/tmp/recovery.conf
20
- # #echo "recovery_target = 'immediate'" >>/tmp/recovery.conf
21
- # echo "recovery_target_action = 'promote'" >>/tmp/recovery.conf
22
- # mv /tmp/recovery.conf "$PGDATA/recovery.conf"
23
- #
24
- # # setup postgresql.conf
25
- # touch /tmp/postgresql.conf
26
- # echo "wal_level = replica" >>/tmp/postgresql.conf
27
- # echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS
28
- #
29
- # echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
30
- #
31
- # echo "wal_log_hints = on" >>/tmp/postgresql.conf
32
-
33
- # ****************** Recovery config 12, 13, 14 **************************
34
- touch $PGDATA /recovery.signal
35
-
36
- # setup postgresql.conf
37
- touch /tmp/postgresql.conf
38
- echo " restore_command = 'wal-g wal-fetch %f %p'" >> /tmp/postgresql.conf
39
- # echo "recovery_target_timeline = 'latest'" >>/tmp/postgresql.conf
40
- if [[ " ${PITR_TIME:- 0} " != " latest" ]]; then
41
- echo " recovery_target_time = '$PITR_TIME '" >> /tmp/postgresql.conf
14
+ # check postgresql veriosn
15
+
16
+ if [[ " $PG_MAJOR " == " 11" ]]; then
17
+
18
+ # ****************** Recovery config 11 **************************
19
+ touch /tmp/recovery.conf
20
+ echo " restore_command = 'wal-g wal-fetch %f %p'" >> /tmp/recovery.conf
21
+ echo " standby_mode = on" >> /tmp/recovery.conf
22
+ echo " trigger_file = '/run_scripts/tmp/pg-failover-trigger'" >> /tmp/recovery.conf # [ name whose presence ends recovery]
23
+ if [[ " ${PITR_TIME:- 0} " != " latest" ]]; then
24
+ echo " recovery_target_time = '$PITR_TIME '" >> /tmp/recovery.conf
25
+ else
26
+ echo " recovery_target_timeline = 'latest'" >> /tmp/recovery.conf
27
+ fi
28
+ echo " recovery_target_action = 'promote'" >> /tmp/recovery.conf
29
+ mv /tmp/recovery.conf " $PGDATA /recovery.conf"
30
+
31
+ # setup postgresql.conf
32
+ touch /tmp/postgresql.conf
33
+ echo " wal_level = replica" >> /tmp/postgresql.conf
34
+ echo " max_wal_senders = 90" >> /tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS
35
+
36
+ echo " wal_keep_segments = 64" >> /tmp/postgresql.conf
37
+
38
+ echo " wal_log_hints = on" >> /tmp/postgresql.conf
42
39
else
43
- echo " recovery_target_timeline = 'latest'" >> /tmp/postgresql.conf
44
- fi
45
- echo " recovery_target_action = 'promote'" >> /tmp/postgresql.conf
46
- echo " wal_level = replica" >> /tmp/postgresql.conf
47
- echo " max_wal_senders = 90" >> /tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS
40
+ # ****************** Recovery config 12, 13, 14 **************************
41
+ touch $PGDATA /recovery.signal
42
+
43
+ # setup postgresql.conf
44
+ touch /tmp/postgresql.conf
45
+ echo " restore_command = 'wal-g wal-fetch %f %p'" >> /tmp/postgresql.conf
46
+ # echo "recovery_target_timeline = 'latest'" >>/tmp/postgresql.conf
47
+ if [[ " ${PITR_TIME:- 0} " != " latest" ]]; then
48
+ echo " recovery_target_time = '$PITR_TIME '" >> /tmp/postgresql.conf
49
+ else
50
+ echo " recovery_target_timeline = 'latest'" >> /tmp/postgresql.conf
51
+ fi
52
+ echo " recovery_target_action = 'promote'" >> /tmp/postgresql.conf
53
+ echo " wal_level = replica" >> /tmp/postgresql.conf
54
+ echo " max_wal_senders = 90" >> /tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS
48
55
49
- echo " wal_keep_size = 64" >> /tmp/postgresql.conf
50
- echo " hot_standby = on" >> /tmp/postgresql.conf
51
- echo " wal_log_hints = on" >> /tmp/postgresql.conf
56
+ echo " wal_keep_size = 64" >> /tmp/postgresql.conf
57
+ echo " hot_standby = on" >> /tmp/postgresql.conf
58
+ echo " wal_log_hints = on" >> /tmp/postgresql.conf
59
+
60
+ fi
52
61
53
62
# ****************** Recovery config 12 **************************
54
63
# we are not doing any archiving by default but it's better to have this config in our postgresql.conf file in case of customization.
0 commit comments