PolarSearch supports backing up index data from your cluster to an Object Storage Service (OSS) bucket using the snapshot feature, or restoring data from OSS. This feature enables cross-cluster data migration and custom backup and restore for PolarSearch clusters, providing a flexible, low-cost solution for data protection and transfer.
This feature is currently in a canary release. To use it, you can submit a ticket to contact Alibaba Cloud support and request that the feature be enabled for your account.
Scope
Your PolarSearch version must be 2.19.3 or later.
NoteYou can access PolarSearch using the search endpoint to view the PolarSearch version in
version.number.You have enabled Alibaba Cloud Object Storage Service (OSS) and created a bucket to store snapshots.
Prepare a Resource Access Management (RAM) user and grant the
AliyunOSSFullAccessaccess policy to the RAM user. For details, see Grant permissions to a RAM user.
Billing Details
The snapshot feature is free. However, snapshot files stored in your OSS bucket incur OSS storage and request fees. For billing details, see OSS Billing overview.
Register a Snapshot Repository
Before you use the snapshot feature, register a snapshot repository to associate it with your OSS bucket. Use the following API to create the repository:
PUT /_snapshot/{repo-name}
{
"type": "oss",
"settings": {
"endpoint": "{endpoint}",
"bucket": "{bucket-name}",
"base_path": "{path-name}",
"region": "{region}",
"access_key": "{your-AccessKey-ID}",
"secret_key": "{your-AccessKey-Secret}",
"session_token": "{your-STS-Token}"
}
}Parameter description
Parameter | Description |
| Repository name. Customize it. |
| Repository type. Set to |
| The endpoint of your OSS bucket. For details, see Regions and endpoints. |
| The name of your OSS bucket. |
| (Optional) Specify the root directory path in the OSS bucket to store snapshot files. |
| Specify the region where the bucket is located. |
| Your AccessKey ID. |
| Your AccessKey Secret. |
| (Optional) The Security Token Service (STS) token of your RAM role. Important If you use an STS token, set |
Example
Replace the following parameters with your actual information.
curl -X PUT "https://{pc-endpoint}:3001/_snapshot/{repo-name}" \
-u "{username}:{passwd}" \
-H "Content-Type: application/json" \
-d '{
"type": "oss",
"settings": {
"endpoint": "{endpoint}",
"bucket": "{bucket-name}",
"base_path": "{path-name}",
"region": "{region}",
"access_key": "{your-AccessKey-ID}",
"secret_key": "{your-AccessKey-Secret}"
}
}'
Create a Snapshot: Back Up Data to OSS
After you register a snapshot repository, run the following command to create a snapshot for the specified index. Use the following API to create the snapshot:
PUT /_snapshot/{repo-name}/{snapshot-name}?wait_for_completion=true
{
"indices": "{index-name}",
"ignore_unavailable":false
}Parameter description
Parameter category | Parameter name | Description |
Request parameters |
| Whether to synchronously wait for the snapshot operation to complete. Default is
|
Request body parameters |
| Specify the indexes to back up. Wildcard characters ( Note Using a wildcard character ( |
| Whether to ignore the specified index if it does not exist and continue creating the snapshot. Default is | |
| Whether to allow creating partial snapshots. If set to |
Example
Replace the following parameters with your actual information.
curl -X PUT "https://{pc-endpoint}:3001/_snapshot/{repo-name}/{snapshot-name}?wait_for_completion=true" \
-u "{username}:{passwd}" \
-H "Content-Type: application/json" \
-d '{
"indices": "{index-name}",
"ignore_unavailable": false
}'View Snapshots
View all snapshot information in your OSS snapshot repository. Use the following API to retrieve the list:
GET /_snapshot/{repo-name}/_all?prettyExample
Replace the following parameters with your actual information.
curl -X GET "https://{pc-endpoint}:3001/_snapshot/{repo-name}/_all?pretty" -u "{username}:{passwd}"Restore Data
Run the following command to restore index data from the specified snapshot. Use the following API to perform the restore operation:
To restore a snapshot from one PolarSearch cluster to another PolarSearch cluster, the destination PolarSearch cluster must register the same snapshot repository as the source PolarSearch cluster. If you perform the restore operation within the same PolarSearch cluster, re-registration is not required, and you can directly restore the data.
POST /_snapshot/{repo-name}/{snapshot-name}/_restore?wait_for_completion=true
{
"indices": "{index-name}",
"ignore_unavailable": true
}Parameter description
Parameter category | Parameter name | Description |
Request parameters |
| Whether to synchronously wait for the snapshot restoration to complete. Default is
|
Request body parameters |
| Specify the indexes to restore. Wildcard characters ( |
| Whether to ignore the specified index if it does not exist and continue creating the snapshot. Default is | |
| Whether to allow creating partial snapshots. If set to | |
| Overwrite index settings in the snapshot during restoration. For example, modify the number of replicas to suit the destination cluster's configuration. | |
| Specify a list of index settings to ignore during restoration, typically used to ignore original unique configurations. |
Example
Replace the following parameters with your actual information.
curl -X POST "https://{pc-endpoint}:3001/_snapshot/{repo-name}/{snapshot-name}/_restore?wait_for_completion=true" \
-u "{username}:{passwd}" \
-H "Content-Type: application/json" \
-d '{
"indices": "{index-name}",
"ignore_unavailable": true
}'