Skip to content

Commit

Permalink
Add postgres pitr support with physical backup (#36)
Browse files Browse the repository at this point in the history
Signed-off-by: souravbiswassanto <[email protected]>
  • Loading branch information
souravbiswassanto authored Sep 25, 2024
1 parent 066e7b5 commit 3261c18
Show file tree
Hide file tree
Showing 37 changed files with 96 additions and 66 deletions.
2 changes: 1 addition & 1 deletion role_scripts/10/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/10/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi

echo "shared_preload_libraries = 'pg_stat_statements'" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/10/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi

echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/10/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/11/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/11/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/11/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/11/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/12/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/12/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi

if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/12/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/12/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_segments = 64" >>/tmp/postgresql.conf
echo "wal_keep_segments = 160" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/13/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/13/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/13/standby/remote-replica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/13/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/13/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/14/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/14/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/14/standby/remote-replica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/14/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/14/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/15/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
echo "max_replication_slots = 90" >>/tmp/postgresql.conf
echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/15/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
2 changes: 1 addition & 1 deletion role_scripts/15/standby/remote-replica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/15/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/15/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf #it was "wal_keep_segments" in earlier version. changed in version 13
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi
if [[ "$WAL_LIMIT_POLICY" == "ReplicationSlot" ]]; then
CLEAN_HOSTNAME="${HOSTNAME//[^[:alnum:]]/}"
Expand Down
4 changes: 2 additions & 2 deletions role_scripts/16/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ echo "wal_level = replica" >>/tmp/postgresql.conf
echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf
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

# echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
# echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
if [ ! -z "${WAL_RETAIN_PARAM:-}" ] && [ ! -z "${WAL_RETAIN_AMOUNT:-}" ]; then
echo "${WAL_RETAIN_PARAM}=${WAL_RETAIN_AMOUNT}" >>/tmp/postgresql.conf
else
echo "wal_keep_size = 1024" >>/tmp/postgresql.conf
echo "wal_keep_size = 2560" >>/tmp/postgresql.conf
fi

echo "wal_log_hints = on" >>/tmp/postgresql.conf
Expand Down
Loading

0 comments on commit 3261c18

Please sign in to comment.