Enable auto snapshot

  1. Log on to the Alibaba Cloud Elasticsearch console.
  2. On the Instances page, click the target instance ID. You will be directed to the Basic Information page.
  3. In the left-side navigation pane, click Snapshots.
  4. On the Snapshots page, switch on Enable Auto Snapshot.

  5. Click Modify Configuration in the upper-right corner to set the time when the daily snapshot is created.


Restore snapshots into instances

If you have enabled auto snapshot for a specified Alibaba Cloud Elasticsearch instance, snapshots will be automatically created on a daily basis. You can call the corresponding snapshot operation to restore a snapshot into the Alibaba Cloud Elasticsearch instance where the snapshot is created.

Note
  • The first snapshot is a complete backup created on a running Alibaba Cloud Elasticsearch instance. The following snapshots are created based on the incremental data of the Elasticsearch instance. Therefore, it takes a longer time to create the first snapshot, but a shorter time to create subsequent snapshots.
  • A snapshot does not store monitoring data generated by an Alibaba Cloud Elasticsearch instance, such as the .monitoring and .security_audit files.
  • An auto snapshot can only be restored into the Alibaba Cloud Elasticsearch instance where the snapshot is created.
  • An auto snapshot repository is created when the first snapshot is created.
View all snapshot repositories

You can run the GET _snapshot command to view all snapshot repositories.

The following response is returned:
{
  "aliyun_auto_snapshot": {
    "type": "oss",
    "settings": {
      "compress": "true",
      "base_path": "xxxx",
      "endpoint": "xxxx"
    }
  }
}
  • aliyun_auto_snapshot: the name of the repository.
  • type: the storage medium where snapshots are stored. This example uses Alibaba Cloud Object Storage Service (OSS).
  • compress:true: enables compression of an index's metadata files.
  • base_path: the location of the snapshots.
  • endpoint: the region of the OSS instance.
View all snapshots

You can run the GET _snapshot/aliyun_auto_snapshot/_all command to view all snapshots stored in the repository aliyun_auto_snapshot

The following response is returned:
{
  "snapshots": [ 
    {
      "snapshot": "es-cn-abcdefghijklmn_20180627091600",
      "uuid": "MMRniVLPRAiawSCm8D8Dug",
      "version_id": 5050399,
      "version": "5.5.3",
      "indices": [
        "index_1",
        ".security",
        ".kibana"
      ],
      "state": "SUCCESS",
      "start_time": "2018-06-27T01:16:01.009Z",
      "start_time_in_millis": 1530062161009,
      "end_time": "2018-06-27T01:16:05.632Z",
      "end_time_in_millis": 1530062165632,
      "duration_in_millis": 4623,
      "failures": [],
      "shards": {
        "total": 12,
        "failed": 0,
        "successful": 12
      }
    }
  ]
}
Default parameters
Auto snapshots also support the following parameters that are not displayed:
  • max_snapshot_bytes_per_sec:40mb: throttles per node snapshot rate. The default snapshot rate is 40 MB per second.
  • max_restore_bytes_per_sec:40mb: throttles per node restore rate. The default restore rate is 40 MB per second.
  • chunk_size: Max 1Gb: large files can be broken into smaller chunks during the snapshot process if needed. The maximum size of a chunk is 1 GB.
Restore a snapshot into an instance
You can run the _restore command to restore a snapshot into an instance:
  • Restore all indexes in a specified snapshot that is stored in the aliyun_auto_snapshot repository. The restore tasks are executed in the background.
    POST _snapshot/aliyun_auto_snapshot/<snapshot>/_restore

    <snapshot>: replace it with the name of the specified snapshot. Example: es-cn-abcdefghijklmn_20180627091600

  • Restore all indexes in the specified snapshot that is stored in the aliyun_auto_snapshot repository, and receive a response after all restore tasks are completed:
    The _restore command runs restore tasks asynchronously. The Alibaba Cloud Elasticsearch instance will return a response immediately if the restore command is executable. Restore tasks are executed in the background. You can add the wait_for_completion parameter to the command. This parameter requires the Alibaba Cloud Elasticsearch instance to return the response only after the restore tasks are completed.
    POST _snapshot/aliyun_auto_snapshot/<snapshot>/_restore? wait_for_completion=true

    <snapshot>: replace it with the name of the specified snapshot. Example: es-cn-abcdefghijklmn_20180627091600.

  • Restore indexes in the specified snapshot that is stored in the aliyun_auto_snapshot repository, and rename the restored indexes. The restore tasks are executed in the background.
    POST _snapshot/aliyun_auto_snapshot/<snapshot>/_restore 
    {
    "indices": "index_1",
    "rename_pattern": "index_(.+)",
    "rename_replacement": "restored_index_$1"
    }
    • <snapshot>: replace it with the name of the specified snapshot. Example: es-cn-abcdefghijklmn_20180627091600.
    • indices: specifies names of the indexes that you need to restore.
    • rename_pattern: uses a regular expression to match the restored indexes. This parameter is optional.
    • rename_replacement: renames the index that matches the regular expression. This parameter is optional.