Enabling Automatic Snapshot Creation¶
Function¶
This API is used to enable the automatic snapshot creation function.
URI¶
POST /v2.0/{project_id}/clusters/{cluster_id}/snapshots/policy/open
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name. |
cluster_id | Yes | String | ID of the cluster that the snapshot belongs to. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
indices | No | String | Name of an index to be restored. Multiple indexes are separated by commas (,). By default, all indexes are restored. You can use the combination of a backslash and an asterisk ( |
keepday | Yes | Integer | Set the number of retained snapshots. The value ranges from 1 to 90. 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. |
frequency | No | String | Frequency of automatically creating snapshots. Note The default value is DAY. If this parameter is set to HOUR, the scheduled task is executed every hour. If this parameter is set to DAY, the scheduled task is executed every day. If this parameter is set to SUN, MON, TUE, WED, THU, FRI or SAT, the scheduled task is executed at the specified day of every week. For example, SUN indicates that the task is executed once every Sunday. 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. Set this value based on actual conditions. |
period | Yes | String | Time when a snapshot is generated every day. Snapshots can only be generated on the hour. The format is HH:mm z: 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. Note The default value is 00:00 GMT+08:00. 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. |
prefix | Yes | String | Prefix of a snapshot that is automatically created, which is manually entered. Enter up to 32 characters and start with a lowercase letter. Lowercase letters, digits, hyphens (-), and underscores (_) are allowed. |
Response Parameters¶
None
Example Requests¶
Enable the automatic backup function.
POST /v2.0/6204a5bd270343b5885144cf9c8c158d/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/snapshots/policy/open
{
"indices" : "*",
"keepday" : 7,
"frequency" : "DAY",
"period" : "16:00 GMT+08:00",
"prefix" : "snapshot"
}
Example Responses¶
None
Status Codes¶
Status Code | Description |
---|---|
200 | Request succeeded. |
400 | Invalid request. Modify the request before retry. |
403 | Request rejected.The server has received the request and understood it, but refused to respond to it. The client should not repeat the request without modifications. |
Error Codes¶
See Error Codes.