Alibaba Cloud Elasticsearch allows you to configure shared Object Storage Service (OSS) repositories for your cluster. This way, you can restore data to your cluster from the automatic snapshots that are stored in the repositories. For example, you have two Elasticsearch V6.7.0 clusters es-cn-a and es-cn-b. The Auto Snapshot feature is enabled for the es-cn-a cluster, and an automatic snapshot is created for the cluster. If you want to restore the data in the snapshot to the es-cn-b cluster, you can configure the OSS repository that stores the snapshot as a shared OSS repository for the es-cn-b cluster.

Background information

The data backup and restoration of Alibaba Cloud Elasticsearch clusters depend on the elasticsearch-repository-oss plug-in. By default, the plug-in is installed on Alibaba Cloud Elasticsearch clusters and cannot be removed. For more information about this plug-in, see elasticsearch-repository-oss.

Prerequisites

The source and destination Elasticsearch clusters must meet the following requirements:
  • The clusters reside in the same region.
  • The clusters belong to the same Alibaba Cloud account.
  • The version of the source cluster is earlier than or the same as that of the destination cluster.

    If the versions of the source and destination clusters are both V6.7.0 of the Standard Edition, the latest kernel must be used for the clusters. Alternatively, the kernel version of the destination cluster must be later than that of the source cluster.

    Notice
    • An Elasticsearch cluster can use only the repository for an Elasticsearch cluster of the same or an earlier version.
    • When a cluster uses the repository for a cluster of an earlier version, the cluster may be incompatible with the data format of the cluster of an earlier version. For example, you can restore an index that has only one document type to an Elasticsearch V6.7.0 cluster from snapshots in the repository of an Elasticsearch V5.5.3 cluster. However, if you restore an index that has multiple document types to the Elasticsearch V6.7.0 cluster from snapshots in the repository of the Elasticsearch V5.5.3 cluster, an error may occur. This is because Elasticsearch V6.7.0 clusters do not support indexes that have multiple document types.

Add a shared OSS repository

  1. Log on to the Elasticsearch console.
  2. In the left-side navigation pane, click Elasticsearch Clusters.
  3. Navigate to the desired cluster.
    1. In the top navigation bar, select the resource group to which the cluster belongs and the region where the cluster resides.
    2. In the left-side navigation pane, click Elasticsearch Clusters. On the Elasticsearch Clusters page, find the cluster and click its ID.
  4. In the left-side navigation pane of the page that appears, click Snapshots.
  5. In the Shared OSS Repositories section, click Create Now.
    Note If this is not the first time you add a shared OSS repository, click Create Shared Repository.
  6. In the Create Shared Repository dialog box, select an Elasticsearch cluster.
    Notice The selected cluster must meet the preceding requirements.
  7. Click OK.
    After the shared repository is added, the current page shows the cluster that owns the repository and the repository status. Shared repository successfully added
    Notice The system retrieves the repository list based on the selected Elasticsearch cluster. If the cluster is updating its configuration, is abnormal, or encounters heavy workloads, the system may fail to retrieve the repository list. If this error occurs, you can log on to the Kibana console of the cluster and run the GET _snapshot command to retrieve the endpoints of all repositories.
  8. Restore an index.
    Shared OSS repositories are used only to share data between Elasticsearch clusters. The system cannot directly restore data to a cluster from the shared OSS repositories. If you want to restore an index to an Elasticsearch cluster, run the related command in the Kibana console of the cluster. For example, to restore the file-2019-08-25 index from the es-cn-a cluster, perform the following steps:
    1. Log on to the Kibana console of the Elasticsearch cluster to which you want to restore the index.
      For more information, see Log on to the Kibana console.
      Note In this example, an Elasticsearch V6.7.0 cluster is used. Operations on clusters of other versions may differ. The actual operations in the console prevail.
    2. In the left-side navigation pane, click Dev Tools.
    3. On the Console tab of the page that appears, run the following command to query the information of all snapshots in the repository of the es-cn-a cluster:
      GET /_cat/snapshots/aliyun_snapshot_from_es-cn-a?v
      The command returns information about all snapshots in the repository. Information about all snapshots in the repository
      Note aliyun_snapshot_from_es-cn-a is the name of the shared repository that is added in Add a shared OSS repository.
    4. Restore indexes from the snapshot based on the returned information.
      Notice
      • Before you restore an index, make sure that the destination cluster does not have an index with the same name. If the destination cluster has an index with the same name, make sure that the index is disabled. If the index is enabled, an error occurs during index restoration.
      • Indexes whose names start with a period (.) are system indexes. We recommend that you do not restore these indexes. If you restore these indexes, you may fail to access the Kibana console.
      • Restore a single index
        POST _snapshot/aliyun_snapshot_from_es-cn-a/es-cn-a_20190705220000/_restore 
         null
      • Restore multiple indexes
        POST _snapshot/aliyun_snapshot_from_es-cn-a/es-cn-a_20190705220000/_restore
         null
      • Restore all indexes other than indexes whose names start with a period (.)
        POST _snapshot/aliyun_snapshot_from_es-cn-a/es-cn-a_20190705220000/_restore 
        null