Change backup expiry time

Learn how to change the expiry time of a database backup.

Prerequisites

There are no prerequisites for this procedure.

Procedure

This procedure uses the command-line tool confd_client, which is available on all database nodes. For more information, see ConfD.

Placeholder values are indicated with UPPERCASE characters. Replace the placeholders with your own values.

  1. Connect to the cluster operating system (COS) using c4 connect -i PLAY_ID -s cos.

    Example:
    Copy
    ./c4 connect -i c3275f84 -s cos

    To find the play ID, you can use c4 ps.

    For more information about how to use c4 commands, see How to use c4.

  2. To find the database name when you are connected to COS, use the ConfD job db_list.

    Example:
    Copy
    confd_client db_list
    - MY_DATABASE
  3. Use the ConfD job db_backup_list to get the ID of the backup. For example:

    Copy
    confd_client db_backup_list db_name: MY_DATABASE

    - bid: 1
      comment: ''
      dependencies: '-'
      expire: 2024-06-20 12:08
      expire_alterable: 10001 MY_DATABASE/id_1/level_0
      expired: false
      id: 10001 MY_DATABASE/id_1/level_0/node_0/backup_202406131208 MY_DATABASE
      last_item: true
      level: 0
      path: MY_DATABASE/id_1/level_0/node_0/backup_202406131208
      system: MY_DATABASE
      timestamp: 2024-06-13 12:08
      ts: '202406131208'
      usable: true
      usage: 0.011 GiB
      volume: r0001
  4. To change the expiry time of the backup, use the ConfD job db_backup_change_expiration with the following parameters:

    Parameter name Data type Description
    backup_volume_id integer ID of the archive volume storing the backup. Can be substituted by backup_volume_name.
    backup_files string

    The prefix of the backup files.

    The prefix is generally in the format <db_name>/<id_#>/<level_#>. For example: exa_db/id_1/level_0

    expire_time string

    Expiration time for the backup in the format YYYY-MM-DD hh:mm:ss.

    If the string value is empty, the backup will not expire.

Examples:

Specify a new expiry time:

Copy
confd_client db_backup_change_expiration backup_volume_id: 1 backup_files: exa_db/id_1/level_0 expire_time: '2027-07-15 5:00:00'

Remove the expiry time (backup will never expire):

Copy
confd_client db_backup_change_expiration backup_volume_id: 1 backup_files: exa_db/id_1/level_0 expire_time: '""'