Configuring the Automatic Snapshot Creation Policy
Function
This API is used to configure automatic snapshot creation policies. When automatic snapshot creation is enabled, snapshots are automatically created daily or weekly based on a preset time schedule, ensuring ongoing data protection. By configuring an automatic snapshot policy, you reduce manual operations while improving backup reliability and efficiency.
Calling Method
For details, see Calling APIs.
URI
POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot/policy
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition: Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name. Constraints: N/A Value range: Project ID of the account. Default value: N/A |
|
cluster_id |
Yes |
String |
Definition: ID of the cluster for which you want to enable automatic snapshot creation. For details about how to obtain the cluster ID, see Obtaining the Cluster ID. Constraints: N/A Value range: Cluster ID. Default value: N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
indices |
No |
String |
Definition: Name of the index to be backed up. Constraints:
You can use an asterisk () to match multiple indexes. For example, index indicates that all indexes with the prefix index will be backed up. Value range: The value can contain 0 to 1,024 characters. It cannot contain uppercase letters, spaces, or the following special characters: "<|>/? Default value: The default value is empty, indicating that all indexes will be backed up. |
|
prefix |
No |
String |
Definition: Prefix of the name of an automatically created snapshot. A snapshot name consists of the snapshot name prefix and timestamp, for example, snapshot-1566921603720. Constraints: This parameter is mandatory when enable is set to true. Value range: Enter up to 32 characters and start with a lowercase letter. Lowercase letters, digits, hyphens (-), and underscores (_) are allowed. Default value: N/A |
|
period |
No |
String |
Definition: Time when a snapshot is created every day. Constraints:
NOTE:
When frequency is set to HOUR, you do not need to specify period. By default, snapshot creation starts from the next hour after the settings are successful.
Value range: Snapshots can only be created on the hour. The time format is the time followed by the time zone, specifically, HH:mm z. In the format, HH:mm refers to the hour time and z refers to the time zone. For example, 00:00 GMT+08:00 and 01:00 GMT+08:00. Default value: 00:00 GMT+08:00 |
|
keepday |
No |
Integer |
Definition: Customize the number of snapshots to be retained. Expired snapshots will be automatically deleted on the half hour. The deletion policy applies only to automated snapshots that are executed at the same frequency as the current automatic snapshot creation policy. Constraints:
Value range: 1–90 Default value: N/A |
|
enable |
Yes |
String |
Definition: Whether to enable automatic snapshot creation. Constraints: N/A Value range:
Default value: false |
|
delete_auto |
No |
String |
Definition: Whether to clear all the automatically created snapshots when disabling automatic snapshot creation. Constraints: If automatic snapshot creation is disabled without deleting automatically created snapshots, all such snapshots in the cluster cannot be manually deleted later once automatic snapshot creation is enabled again. Instead, they can only be deleted by the system based on the snapshot lifecycle policy. Value range:
Default value: false |
|
frequency |
No |
String |
Definition: Frequency of automatically creating snapshots. Constraints: The number of retained snapshots depends on the execution frequency and indexes set in the automatic snapshot creation policy. If the execution interval is short or the index data volume is large, the number of retained automatic snapshots may not reach the preset value. Value range:
Default value: DAY |
Response Parameters
Status code: 200
Request succeeded.
None
Example Requests
Configure the automatic snapshot creation policy.
POST https://{Endpoint}/v1.0/{project_id}/clusters/4f3deec3-efa8-4598-bf91-560aad1377a3/index_snapshot/policy
{
"prefix" : "snapshot",
"period" : "16:00 GMT+08:00",
"keepday" : 7,
"frequency" : "DAY",
"enable" : "true",
"delete_auto" : "false"
}
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
|
406 |
The server could not fulfill the request according to the content characteristics of the request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.