Updated on 2023-06-20 GMT+08:00

Index Backup and Restoration

You can back up index data in clusters. If data loss occurs or you want to retrieve data of a specified duration, you can restore the index data. Index backup is implemented by creating cluster snapshots. When creating a backup for the first time, you are advised to back up data of all indexes.

  • Managing Automatic Snapshot Creation: Snapshots are automatically created at a specified time each day according to the rules you create. You can enable or disable the automatic snapshot creation function and set the automatic snapshot creation policy.
  • Manually creating a snapshot: You can manually create a snapshot at any time to back up all data or data of specified indexes.
  • Restoring data: You can use existing snapshots to restore the backup index data to a specified cluster.
  • Deleting a snapshot: Delete snapshots you do not require and release resources.
  • Before creating a snapshot, you need to perform basic configurations, including configuring the OBS bucket for storing snapshots, the snapshot backup path, and IAM agency used for security authentication.
  • If there are available snapshots in the snapshot list when you configure the OBS bucket for storing cluster snapshots for the first time, you cannot change the bucket for snapshots that are subsequently created automatically or manually. Therefore, exercise caution when you configure the OBS bucket.
  • If you want to change the OBS bucket where there are snapshots, do as follows: Disable the snapshot function, enable it, and specify a new OBS bucket. After you disable the snapshot function, you cannot use previously created snapshots to restore the cluster.
  • If a cluster is in the Unavailable status, you can use the cluster snapshot function only to restore clusters and view existing snapshot information.
  • During backup and restoration of a cluster, you can perform only certain operations, including scaling out, accessing Kibana, viewing metric, and deleting other snapshots of clusters. However, you cannot perform the following operations: restarting or deleting the cluster, deleting a snapshot that is in the Creating or Restoring status, and creating or restoring another snapshot. If a snapshot is being created or restored for a cluster, any automatic snapshot creation task initiated for the cluster will be canceled.
  • The first snapshot of a cluster is a full snapshot, and subsequent snapshots are incremental snapshots. CSS snapshot files depend on each other.
  • If you restore a CSS cluster snapshot to another cluster, indexes with the same name in the destination cluster will be overwritten. If the snapshot and the destination cluster use different shards, the indexes with the same name will not be overwritten.

Prerequisites

To use the function of creating or restoring snapshots, the account or IAM user logging in to the CSS management console must have both of the following permissions:

  • Tenant Administrator for project OBS in region Global service
  • Elasticsearch Administrator in the current region

Managing Automatic Snapshot Creation

  1. In the CSS navigation pane on the left, click Clusters.
  2. On the Clusters page that is displayed, click the name of the target cluster. In the navigation pane on the left, choose Cluster Snapshots.
  3. On the displayed Cluster Snapshots page, click the icon to the right of Cluster Snapshot to enable the cluster snapshot function.
  4. Enable the cluster snapshot function. OBS buckets and IAM agencies are automatically created to store snapshots. The automatically created OBS bucket and IAM agency are displayed on the page. You can also click on the right of Basic Configuration to edit the configuration.
    Table 1 Cluster snapshot parameter

    Parameter

    Description

    OBS bucket

    Select an OBS bucket for storing snapshots from the drop-down list box. You can also click Create Bucket on the right to create an OBS bucket.

    The created or existing OBS bucket must meet the following requirements:

    • Storage Class is Standard.
    • CSS does not support encrypted OBS buckets. When selecting an OBS bucket for snapshot storage, do not enable bucket encryption.

    Backup Path

    Storage path of the snapshot in the OBS bucket.

    The backup path configuration rules are as follows:
    • The backup path cannot contain the following characters: \:*?"<>|
    • The backup path cannot start with a slash (/).
    • The backup path cannot start or end with a period (.).
    • The backup path cannot contain more than 1,023 characters.

    IAM Agency

    IAM agency authorized by the current account to CSS access or maintain data stored in the OBS bucket. You can also click Create IAM Agency on the right to create an IAM agency.

    The created or existing IAM agency must meet the following requirements:

    • Agency Type must be Cloud service.
    • Set Cloud Service to Elasticsearch or CSS.
    • The agency must have the Tenant Administrator permission for the OBS project in Global service.
  5. Enable the automatic snapshot creation function. The Configure Automatic Snapshot Creation dialog box is displayed. If the automatic snapshot creation function is enabled, you can click on the right of Automatic Snapshot Creation to modify the snapshot policy.
    • Snapshot Name Prefix: Enter a maximum of 32 characters starting with a lowercase letter. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. A snapshot name consists of a snapshot name prefix and a timestamp, for example, snapshot-2018022405925.
    • Time Zone: indicates the time zone for the backup time. Specify Backup Start Time based on the time zone.
    • Index: Enter an index name. You can select an index for backup. Use commas (,) to separate multiple indexes. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/? If you do not specify this parameter, data of all indexes in the cluster is backed up by default. You can use the asterisk (*) to back up data of certain indices. For example, if you enter index*, then data of indices with the name prefix of index will be backed up.

      Run the GET /_cat/indices command in Kibana to query the names of all indexes in the cluster.

    • Backup Start Time: indicates the time when the backup starts automatically every day. You can specify this parameter only in hours and not minutes, for example, 00:00 or 01:00. The value ranges from 00:00 to 23:00. Select the backup time from the drop-down list box.
    • Retention Period (days): indicates the duration when snapshots are retained in the OBS bucket, in days. The value ranges from 1 to 90. You can specify this parameter as required. The system automatically deletes snapshots that are retained over the specified retention period on the half hour.
  6. Click OK to save the snapshot policy.

    Snapshots that are automatically created according to the snapshot policy are displayed in the snapshot list, along with manually created snapshots. You can distinguish them by the Snapshot Type setting. In the upper right corner of the snapshot list, enter the keyword of the snapshot name or snapshot ID to search for the desired snapshots.

  7. (Optional) Disable the automatic snapshot creation function.

    After you disable the automatic snapshot creation function, the system stops automatic creation of snapshots. If the system is creating a snapshot based on the automatic snapshot creation policy and the snapshot is not yet displayed in the snapshot list, you cannot disable the automatic snapshot creation function. In this case, if you click the button next to Automatic Snapshot Creation, a message is displayed, indicating that you cannot disable the function. You are advised to disable the function after the system completes automatic creation of the snapshot, and the created snapshot is displayed in the snapshot list.

    When disabling the automatic snapshot creation function, you can choose whether to delete the snapshots that have been automatically created by selecting Delete automated snapshots in the displayed dialog box. By default, automatically created snapshots are not deleted.

    • If you do not select Delete automated snapshots, automatically created snapshots are not deleted when you disable the automatic snapshot creation function. You can manually delete them later. For details, see Deleting a Snapshot. If you do not manually delete the automatically created snapshots and enable the automatic snapshot creation function again, then all snapshots with Snapshot Type set to Automated in the snapshot list of the cluster can only be automatically deleted by the system. Specifically, the system automatically deletes snapshots based on the snapshot policy configured when you enable the automatic snapshot creation function again. For example, if you set Retention Period (days) to 10, the system will automatically delete the snapshots that have been retained for more than 10 days.
    • If you select Delete automated snapshots, all snapshots with Snapshot Type set to Automated in the snapshot list will be deleted when you disable the automatic snapshot creation function.

Manually Creating a Snapshot

  1. In the CSS navigation pane on the left, click Clusters.
  2. On the Clusters page that is displayed, click the name of the target cluster. In the navigation pane on the left, choose Cluster Snapshots.
  3. On the displayed Cluster Snapshots page, click the icon to the right of Cluster Snapshot to enable the cluster snapshot function.
  4. Enable the cluster snapshot function. OBS buckets and IAM agencies are automatically created to store snapshots. The automatically created OBS bucket and IAM agency are displayed on the page. You can also click on the right of Basic Configuration to edit the configuration.
    Table 2 Cluster snapshot parameter

    Parameter

    Description

    OBS bucket

    Select an OBS bucket for storing snapshots from the drop-down list box. You can also click Create Bucket on the right to create an OBS bucket.

    The created or existing OBS bucket must meet the following requirements:

    • Storage Class is Standard.

    Backup Path

    Storage path of the snapshot in the OBS bucket.

    The backup path configuration rules are as follows:
    • The backup path cannot contain the following characters: \:*?"<>|
    • The backup path cannot start with a slash (/).
    • The backup path cannot start or end with a period (.).
    • The backup path cannot contain more than 1,023 characters.

    IAM Agency

    IAM agency authorized by the current account to CSS access or maintain data stored in the OBS bucket. You can also click Create IAM Agency on the right to create an IAM agency.

    The created or existing IAM agency must meet the following requirements:

    • Agency Type must be Cloud service.
    • Set Cloud Service to Elasticsearch or CSS.
    • The agency must have the Tenant Administrator permission for the OBS project in Global service.
  5. After basic configurations are completed, click Create.
    • Name indicates the name of the manually created snapshot, which can contain 4 to 64 characters and must start with a lowercase letter. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. For snapshots you create manually, you can specify the snapshot name. The system will not automatically add the time information to the snapshot name.
    • Index: Enter an index name. You can select an index for backup. Use commas (,) to separate multiple indexes. Uppercase letters, spaces, and the following special characters are not allowed: "\<|>/? If you do not specify this parameter, data of all indexes in the cluster is backed up by default. You can use the asterisk (*) to back up data of certain indices. For example, if you enter index*, then data of indices with the name prefix of index will be backed up.

      Run the GET /_cat/indices command in Kibana to query the names of all indexes in the cluster.

    • Description: indicates the description of the created snapshot. The value contains 0 to 256 characters, and certain special characters (<>) are not allowed.
  6. Click OK.

    After the snapshot is created, it will be displayed in the snapshot list. The status Available indicates that the snapshot is created successfully. All automatically and manually created snapshots are displayed in the snapshot list. You can distinguish them by the Snapshot Type setting. In the upper right corner of the snapshot list, enter the keyword of the snapshot name or snapshot ID to search for the desired snapshots.

Restoring Data

You can use snapshots whose Snapshot Status is Available to restore cluster data. The stored snapshot data can be restored to other clusters.

Restoring data will overwrite current data in clusters. Therefore, exercise caution when restoring data.

  1. In the Snapshots area, locate the row that contains the snapshot you want to restore and click Restore in the Operation column.
  2. On the Restore page, set restoration parameters.

    Index: Enter the name of the index you want to restore. If you do not specify any index name, data of all indexes will be restored. The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?) are not allowed.

    Rename Pattern: Enter a regular expression. Indexes that match the regular expression are restored. The default value index_(.+) indicates restoring data of all indices. The value contains 0 to 1,024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?,) are not allowed.

    Rename Replacement: Enter the index renaming rule. The default value restored_index_$1 indicates that restored_ is added in front of the names of all restored indexes. The value can contain 0 to 1,024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?,) are not allowed. You can set Rename Replacement only if you have specified Rename Pattern.

    Cluster: Select the cluster that you want to restore. You can select the current cluster or others. However, you can only restore the snapshot to clusters whose status is Available. If the status of the current cluster is Unavailable, you cannot restore the snapshot to the current cluster. If you choose to restore the snapshot to another cluster, ensure that the target cluster runs an Elasticsearch version that is not earlier than that of the current cluster. If you select another cluster and two or more indexes in the cluster have the same name, data of all indices with the same name as the name you specify will be overwritten. Therefore, exercise caution when you set the parameters.

  3. Click OK. If restoration succeeds, Task Status of the snapshot in the snapshot list will change to Restoration succeeded, and the index data is generated again according to the snapshot information.

Deleting a Snapshot

If you no longer need a snapshot, delete it to release storage resources. If the automatic snapshot creation function is enabled, snapshots that are automatically created cannot be deleted manually, and the system automatically deletes these snapshots on the half hour after the time specified by Retention Period (days). If you disable the automatic snapshot creation function while retaining the automated snapshots, then you can manually delete them later. If you do not manually delete the automatically created snapshots and enable the automatic snapshot creation function again, then all snapshots with Snapshot Type set to Automated in the snapshot list of the cluster can only be automatically deleted by the system.

After a snapshot is deleted, its data cannot be restored. Exercise caution when deleting a snapshot.

  1. In the snapshot list, locate the snapshot that you want to delete.
  2. Click Delete in the Operation column. In the dialog box that is displayed, confirm the snapshot information and click OK.