HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Archiving

archive_mode

Parameter description: Specifies whether to archive WALs.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

When wal_level is set to minimal, the archive_mode parameter is unavailable.

Value range: Boolean

  • on indicates that the archiving is enabled.
  • off indicates that the archiving is disabled.

Default value: off

archive_command

Parameter description: Specifies the command set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

  • If both archive_dest and archive_commandare configured, WALs are preferentially saved to the directory specified by archive_dest. The command configured by archive_commanddoes not take effect.

  • Any %p in the string is replaced by the absolute path of the file to archive, and any %f is replaced by only the file name. (The relative path is relative to the data directory.) Use %% to embed an actual % character in the command.

  • This command returns zero only if it succeeds. The following shows the command:

archive_command = 'cp --remove-destination %p /mnt/server/archivedir/%f'
  • --remove-destination indicates that files will be overwritten during the archiving.

  • If there are multiple archive commands, write them to the shell script file and set archive_commandto the command for executing the script. For example:

    -- Assume that multiple commands are as follows:
    test ! -f dir/%f && cp %p dir/%f
    -- The content of the test.sh script is as follows:
    test ! -f dir/$2 && cp $1 dir/$2
    -- The archive command is as follows:
    archive_command='sh dir/test.sh %p %f'

Value range: a string

Default value: (disabled)

archive_dest

Parameter description: Specifies the path set by the administrator to archive WALs. You are advised to set the archive log path to an absolute path.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

  • If both archive_dest and archive_commandare configured, WALs are preferentially saved to the directory specified by archive_dest. The command configured by archive_commanddoes not take effect.
  • If the string is a relative path, it is relative to the data directory. The following is an example:
archive_dest = '/mnt/server/archivedir/'

Value range: a string

Default value: an empty string

archive_timeout

Parameter description: Specifies the archiving period.

archive_timeout is suitable for scenarios where active-standby streaming replication is not used or where WAL logs need to be archived. By default, file switching will occur when WAL reaches a certain size, and archiving can copy WAL files at this time. When the system is idle, some WAL logs may remain in the memory and cannot be archived in time. After archive_timeout is set to greater than 0, the system will force the WAL content in the memory to be flushed to the disk when the set value is exceeded to achieve timely archiving of WAL logs.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

  • The server is forced to switch to a new WAL segment file when the period specified by this parameter has elapsed since the last file switch.
  • Archived files that are closed early due to a forced switch are still of the same length as full files. Therefore, a very short archive_timeout will bloat the archive storage. You are advised to set archive_timeout to 60s.

Value range: an integer ranging from 0 to INT_MAX. The unit is second. 0 indicates that archiving timeout is disabled.

Default value: 0

archive_interval

Parameter description: Indicates the archiving interval. In distributed standby archiving and OBS archiving scenarios, a request is sent to the standby to archive all WALs every archive interval, in which case the standby may archive a certain xlog data multiple times, to avoid data loss caused by some files being lost during the archive_timeout period and not archived in time. This parameter is only used for distributed or standby archiving, when you enable it, you need to create additional archive slots, and it is not in use at the moment.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

img NOTICE:

  • Forces archiving of log files when the time set in this parameter is exceeded.
  • Since archiving has IO operations, it must not be archived too frequently, nor can it be set to have a large impact on the PITR RPO It is recommended that the default value be used.

Value range: Integer, 1 ~ 1000, in seconds.

Default value: 1

time_to_target_rpo

Parameter description: In dual database instance offsite disaster recovery mode, set the time_to_target_rpo seconds allowed to the recovery point that has been archived to OBS when an abnormal occurrence occurs in the primary database instance.

This parameter is a SIGHUP parameter. Set it based on instructions provided in Table 1 GUC parameters.

Value range: Integer, 0 to 3600 (seconds)

In dual database instance offsite disaster recovery mode, the primary database instance logs will be archived to OBS.

0 means that log flow control is not enabled, and 1~3600 means to set the time_to_target_rpo seconds allowed from the time of abnormal occurrence of the primary database instance to the recovery point that has been archived to OBS, to ensure that the length of time when the primary database instance crashes due to a disaster, the most data that may be lost, is within the allowable range.

Setting time_to_target_rpo too small will affect the performance of the host and setting it too large will lose the flow control effect.

Default value: 0

Copyright © 2011-2024 www.enmotech.com All rights reserved.