• Cloud Search Service

css
  1. Help Center
  2. Cloud Search Service
  3. User Guide
  4. Managing Clusters
  5. Index Backup and Restoration

Index Backup and Restoration

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

  • Managing Automatic Snapshot Creation: Snapshots are automatically created at specified time every 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: Manually create a snapshot at any time to back up all data or data of specified indices.
  • Restoring data: You can use existing snapshots to restore the backup index data to a specified cluster.
  • Deleting a snapshot: You are advised to delete invalid snapshots to release storage resources.
NOTE:
  • Before creating a snapshot, you need to perform basic configurations, including configuring the OBS bucket for storing snapshots 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, the bucket cannot be changed for all snapshots that are automatically or manually created later. 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.

    Once the snapshot function is disabled, the previously created snapshots cannot be used to restore the cluster.

  • If a cluster is in the Unavailable state, you can only use the cluster snapshot function to restore clusters and view, instead of editing, existing snapshot information.
  • During backup and restoration of a cluster, allowed operations on the cluster include capacity expansion, Kibana access, metric viewing, and deletion of other snapshots of the clusters, but the following operations are not allowed: restart or deletion of the cluster, deletion of the snapshot that is in the Creating or Restoring state, and the attempt of creating or restoring another snapshot. If a snapshot is being created or restored for a cluster, then the automatic snapshot creation task initiated for the cluster will be canceled.

Prerequisites

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

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

Managing Automatic Snapshot Creation

  1. In the left navigation pane of the CSS management console, click Cluster Management.
  2. On the Cluster Management page that is displayed, click the name of the target cluster. On the displayed page, click Cluster Snapshots.

    Alternatively, on the Cluster Management page, locate the row where the target cluster resides and click More > Back Up and Restore in the Operation column to switch to the Cluster Snapshots page.

  3. On the displayed Cluster Snapshots page, click the icon to the right of Cluster Snapshot to enable the cluster snapshot function.

    indicates to disable the cluster snapshot function. indicates to enable the cluster snapshot function.

  4. (Optional) After the cluster snapshot function is enabled, CSS automatically creates the OBS bucket and IAM agency for you to store snapshots. The automatically created OBS bucket and IAM agency are displayed on the page. If you want to change the OBS bucket and IAM agency, click to the right of Basic Configuration.
    In the displayed Edit Basic Configuration dialog box, you can either select an existing OBS bucket and an IAM agency or create an OBS bucket and an IAM agency. To create an OBS bucket, click Create Bucket. To create an IAM agency, click Create IAM Agency. For details, see Creating a Bucket and Creating an Agency.
    Table 1 Parameter description

    Parameter

    Description

    Precautions

    OBS Bucket

    Indicates the name of the OBS bucket used for storing snapshots.

    The following conditions must be met for existing OBS buckets or those to be created:

    • Storage Class is Standard or Warm.

    IAM Agency

    Indicates that the current account is authorized to access or maintain data stored in OBS on CSS.

    The following conditions must be met for existing IAM agencies or those to be created:

    • Agency Type is Cloud service.
    • Cloud Service is CSS.
    • The agency has the Tenant Administrator permission for the OBS(S3) project in OBS(S3).
    Figure 1 Editing the basic configuration
  5. Click the icon to the right of Automatic Snapshot Creation to enable the automatic snapshot creation function.

    indicates to enable the automatic snapshot creation function, and indicates to disable the automatic snapshot creation function.

  6. In the displayed Create Snapshot Policy dialog box, specify parameters as required.
    • Snapshot Name Prefix: The snapshot name consists of the snapshot name prefix (indicated by this parameter) and time. For example, snapshot-2018022405925, an automatically generated snapshot name. The snapshot name prefix contains 1 to 31 characters and must start with a lowercase letter. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed.
    • Time Zone: indicates the time zone for the backup time. Specify Backup Start At based on the time zone.
    • Backup Start At: indicates the time when the backup starts automatically every day. You can only specify this parameter to an hour time, for example, 00:00 or 01:00. The value range is from 00:00 to 23:00. Select the backup time from the drop-down list box.
    • Retention Period (days): indicates the duration where snapshots are retained in the OBS bucket, in units of day. 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. For example, if you set the snapshot policy as shown in Figure 2, the system, at 00:30 35 days later, will automatically delete the automated snapshots that were created at 00:00 35 days ago.
    Figure 2 Automatic snapshot creation
  7. Click OK.

    After the policy for automatic snapshot creation is created, the policy information will be displayed on the Cluster Snapshots page. If you need to change the policy due to business changes, click .

    Snapshots that are automatically created according to the snapshot policy are displayed in the snapshot list. 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. You can also click to sort the snapshots based on related parameter settings.

    Figure 3 Automatic snapshot creation policy
  8. (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 has not been 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, specifically, 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 configuring 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. In this case, you can manually delete them in the future. 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 left navigation pane of the CSS management console, click Cluster Management.
  2. On the Cluster Management page that is displayed, click the name of the target cluster. On the displayed page, click Cluster Snapshots.

    Alternatively, on the Cluster Management page, locate the row where the target cluster resides and click More > Back Up and Restore in the Operation column to switch to the Cluster Snapshots page.

  3. On the displayed Cluster Snapshots page, click the icon to the right of Cluster Snapshot to enable the cluster snapshot function.

    indicates to disable the cluster snapshot function. indicates to enable the cluster snapshot function.

  4. (Optional) After the cluster snapshot function is enabled, CSS automatically creates the OBS bucket and IAM agency for you to store snapshots. The automatically created OBS bucket and IAM agency are displayed on the page. If you want to change the OBS bucket and IAM agency, click to the right of Basic Configuration. For details about how to configure parameters involved in the basic configuration, see 4.
  5. After basic configurations are complete, click Create Snapshot.
    • Name: indicates the name of the manually created snapshot, which contains 4 to 64 characters and must start with a lowercase letter. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed. Different from the name of the automatically created snapshot, the name of the manually created snapshot is set as specified and time information is not automatically added to the name.
    • Index: Enter the name of the index. The manually created snapshot can back up data of certain indices in the cluster. The value contains 0 to 1024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?) are not allowed. Multiple index names are separated by commas (,). If this parameter is left unspecified, data of all indices 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 2018-06*, then data of indices with the name prefix of 2018-06 will be backed up.

      You can use the GET /_cat/indices command in Kibana to query names of all indices in the cluster. Then, enter the names of the indices you want to back up.

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

    After the snapshot is created, it will be displayed in the snapshot list. 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. You can also click to sort the snapshots based on related parameter settings.

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 Snapshot Management area, locate the row where the snapshot you want to restore resides and click Restore in the Operation column.
  2. In the displayed dialog box, specify parameters as required.

    Index: Enter the name of the index you want to restore. By default, this option is left blank, indicating that data of all indices is restored. The value contains 0 to 1024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?) are not allowed.

    Rename Pattern: Enter a regular expression. Indices that meet the regular expression are restored. The default value index_(.+) indicates to restore data of all indices. The value contains 0 to 1024 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 indices. The value contains 0 to 1024 characters. Uppercase letters, spaces, and certain special characters (including "\<|>/?,) are not allowed. The setting of Rename Replacement takes effect only when Rename Pattern is specified.

    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 in the Available state. Specifically, if the current cluster is in the Unavailable state, you cannot restore the snapshot to the current cluster. If you select another cluster and two or more indices in the cluster have the same name, data of all indices with the same name as that you specify will be overwritten. Therefore, exercise caution when you set the parameters.

    Figure 5 Restoring a snapshot

  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.
    In the snapshot list, the Task Status column indicates the latest status of a snapshot and displays Restoration succeeded only when the latest restoration of a snapshot succeeds.
    Figure 6 Successful restoration

Deleting a Snapshot

If you do not 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 upon the arrival of 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.

NOTE:

After a snapshot is deleted, its data cannot be restored. Therefore, exercise caution when you delete a snapshot.

  1. In the Snapshot Management area, locate the row where the target snapshot resides and click Delete in the Operation column.
  2. In the Delete Snapshot dialog box that is displayed, click OK.