Increasing the PostgreSQL archive_timeout on Kubernetes

Increase change the archive_timeout to 3600 (seconds) so that accumulated wal files do not cause a disk-space issue during a network outage.

About this task

PostgreSQL sends its wal archives to the backup location (S3 or local PVC) whenever the configured archive_timeout period elapses. By default, the archive_timeout is set to 60 seconds. During a network outage, the files cannot be transferred and instead accumulate on the current server, and could cause a disk-space issue. Increasing the archive_timeout value helps to mitigate this issue by creating archive files less frequently.

For information on tracking the Postgres disk space, see Monitoring Postgres disk usage.

Complete the following steps to increase the PostgreSQL archive_timeout value.

Procedure

  1. Get the name of the pgha config map by running the following command:
    kubectl -n <namespace> get cm -l pgha-config='true'

    The response looks like the following example:

    NAME                                               DATA   AGE
    apis-produ-d18f3f0-0d18f3f0-postgres-pgha-config   5      22d
  2. Edit the config map by running the following command:
    kubectl -n <namespace> edit configmap <config-map-name>

    In the command, replace <config-map-name> with the NAME returned in step 1.

  3. Change the archive_timeout value to 3600.

    The value must be an integer, and represents the number of seconds that must elapse before the archive file is generated.

  4. Save the file and exit the editor.

    The configuration is updated automatically; archives will be generated and pushed every 3600 seconds.