Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
59 KiB
Creating an Instance
Function
- This API can be used to create an instance.
- This API is used to restore data from a specified backup to a new instance. The number of nodes of the new instance must be greater than or equal to that in the original instance, and the storage of the new instance must be greater than or equal to that of the original instance.
- This API is used to restore data of a specified instance at a specified point in time to a new instance. The number of nodes of the new instance must be greater than or equal to that in the original instance, and the storage of the new instance must be greater than or equal to that of the original instance.
Constraints
This API can be used for GeminiDB Cassandra instances.
URI
POST https://{Endpoint}/v3/{project_id}/instances
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
Content-Type |
Yes |
String |
MIME type of the request body. application/json is recommended. |
X-Auth-Token |
Yes |
String |
User token. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
name |
Yes |
String |
Instance name, which can be the same as an existing instance name. The name can contain 4 to 64 bytes and must start with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_). |
datastore |
Yes |
Datastore object |
Database information. |
region |
Yes |
String |
Region ID. The value cannot be empty. For details, see Regions and Endpoints. |
availability_zone |
Yes |
String |
AZ ID. For details about the value, see az_status returned in Querying Instance Specifications. If an instance can be created across three AZs, separate multiple AZ IDs by commas (,). |
vpc_id |
Yes |
String |
VPC ID. You can obtain the value with either of the following methods:
|
subnet_id |
Yes |
String |
Subnet ID. You can obtain the subnet ID with either of the following methods:
|
security_group_id |
Yes |
String |
Security group ID. You can obtain the security group ID with either of the following methods:
|
password |
Yes |
String |
Database password. The password can include 8 to 32 characters and contain uppercase letters, lowercase letters, digits, and the following special characters: ~!@#%^*-_=+? Enter a strong password against security risks such as brute force cracking. |
mode |
Yes |
String |
Instance type. The value can be:
|
flavor |
Yes |
Array of Flavor objects |
Instance specifications. For details about the specifications, see parameter values under flavors in Querying Instance Specifications. |
configuration_id |
No |
String |
Parameter template ID. |
backup_strategy |
No |
BackupStrategy object |
Advanced backup policy. |
enterprise_project_id |
No |
String |
Enterprise project ID.
|
ssl_option |
No |
String |
Whether SSL is enabled. The value can be:
|
restore_info |
No |
RestoreInfo object |
Backup information. You can restore data from a specific backup or instance to a specific point in time during the backup retention period. You can restore data only of a GeminiDB Cassandra cluster instance to a specific point in time. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
Yes |
String |
Database type.
|
version |
Yes |
String |
Database version.
|
storage_engine |
Yes |
String |
Storage engine.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
num |
Yes |
String |
Number of nodes.
|
size |
Yes |
String |
Storage space. It must be an integer, in GB. |
storage |
Yes |
String |
Disk type. If you set this parameter to ULTRAHIGH, SSD disks are used. |
spec_code |
Yes |
String |
Resource specification code. For the code, see the value of response parameter spec_code in Querying Instance Specifications. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
start_time |
Yes |
String |
Backup time window. Automated backup will be triggered during the backup time window. The value cannot be empty. It must be the UTC time in the hh:mm-HH:MM format.
|
keep_days |
No |
String |
Backup retention days. The value ranges from 0 to 35.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
backup_id |
No |
String |
Full backup file ID. This parameter cannot be left blank when you create an instance to restore data using a specific backup. |
source_instance_id |
No |
String |
ID of the specified instance that backup data is restored to. This parameter cannot be left blank when you restore data at a specific time point from a specific instance to a new instance. |
restore_time |
No |
Long |
Time point that backup data is restored to. This parameter cannot be left blank when you restore data at a specific point in time from a specific instance to a new instance. The value is a 13-digit number in milliseconds (UTC). You can query the value by following Querying the Time Window When a Backup Can Be Restored. |
Response Parameters
Status code: 202
Parameter |
Type |
Description |
|---|---|---|
id |
String |
Instance ID. |
name |
String |
Instance name. This parameter is the same as the corresponding request parameter. |
datastore |
Datastore object |
Database information. This parameter is the same as the corresponding request parameter. |
created |
String |
Creation time, which is in the yyyy-mm-dd hh:mm:ss format. |
status |
String |
Instance status. The value is creating. |
region |
String |
Region ID. This parameter is the same as the corresponding request parameter. |
availability_zone |
String |
AZ ID. This parameter is the same as the corresponding request parameter. |
vpc_id |
String |
VPC ID. This parameter is the same as the corresponding request parameter. |
subnet_id |
String |
Subnet ID. This parameter is the same as the corresponding request parameter. |
security_group_id |
String |
Security group ID. This parameter is the same as the corresponding request parameter. |
mode |
String |
Instance type. This parameter is the same as the corresponding request parameter. |
flavor |
Array of Flavor objects |
Instance specifications. This parameter is the same as the corresponding request parameter. |
backup_strategy |
BackupStrategy object |
Advanced backup policy. This parameter is the same as the corresponding request parameter. |
ssl_option |
String |
Whether SSL is enabled. This parameter has the same effect as the corresponding request parameter. |
job_id |
String |
ID of the job for creating an instance. |
Parameter |
Type |
Description |
|---|---|---|
type |
String |
Database type.
|
version |
String |
Database version.
|
storage_engine |
String |
Storage engine.
|
Parameter |
Type |
Description |
|---|---|---|
num |
String |
Number of nodes.
|
size |
String |
Storage space. It must be an integer, in GB. |
storage |
String |
Disk type. If you set this parameter to ULTRAHIGH, SSD disks are used. |
spec_code |
String |
Resource specification code. For the code, see the value of response parameter spec_code in Querying Instance Specifications. |
Parameter |
Type |
Description |
|---|---|---|
start_time |
String |
Backup time window. Automated backup will be triggered during the backup time window. The value cannot be empty. It must be the UTC time in the hh:mm-HH:MM format.
|
keep_days |
String |
Backup retention days. The value ranges from 0 to 35.
|
Example Request
- URI example
POST https://{Endpoint}/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances - Creating a pay-per-use 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory
Values of region and availability_zone in the request body are only examples. Set them based on service requirements.
{ "name" : "test-cassandra-01", "datastore" : { "type" : "cassandra", "version" : "3.11", "storage_engine" : "rocksDB" }, "region" : "aaa", "availability_zone" : "bbb", "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password" : "******", "mode" : "Cluster", "flavor" : [ { "num" : 3, "storage" : "ULTRAHIGH", "size" : 500, "spec_code" : "geminidb.cassandra.4xlarge.4" } ], "backup_strategy" : { "start_time" : "08:15-09:15", "keep_days" : 8 }, "ssl_option" : 1 } - Creating a pay-per-use 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory based on data restored using a specific backup
Values of region and availability_zone in the request body are only examples. Set them based on service requirements.
{ "name" : "test-cassandra-01", "datastore" : { "type" : "cassandra", "version" : "3.11", "storage_engine" : "rocksDB" }, "region" : "aaa", "availability_zone" : "bbb", "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password" : "******", "mode" : "Cluster", "flavor" : [ { "num" : 3, "storage" : "ULTRAHIGH", "size" : 500, "spec_code" : "geminidb.cassandra.4xlarge.4" } ], "backup_strategy" : { "start_time" : "08:15-09:15", "keep_days" : 8 }, "ssl_option" : 1, "restore_info" : { "backup_id" : "2f4ddb93b9014b0893d81d2e472f30fe" } } - Creating a yearly/monthly 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory based on the data of a specified instance at a specified point in time
Values of region and availability_zone in the request body are only examples. Set them based on service requirements.
{ "name" : "test-cassandra-01", "datastore" : { "type" : "cassandra", "version" : "3.11", "storage_engine" : "rocksDB" }, "region" : "aaa", "availability_zone" : "bbb", "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007", "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58", "password" : "******", "mode" : "Cluster", "flavor" : [ { "num" : 3, "storage" : "ULTRAHIGH", "size" : 500, "spec_code" : "geminidb.cassandra.4xlarge.4" } ], "backup_strategy" : { "start_time" : "08:15-09:15", "keep_days" : 8 }, "ssl_option" : 1, "restore_info" : { "restore_time" : 1607731200000, "source_instance_id" : "054e292c9880d4992f02c0196d3ein12" } }
Example Response
Status code: 202
Accepted
{
"id" : "39b6a1a278844ac48119d86512e0000bin06",
"name" : "test-cassandra-01",
"datastore" : {
"type" : "cassandra",
"version" : "3.11",
"storage_engine" : "rocksDB"
},
"created" : "2019-10-28 14:10:54",
"status" : "creating",
"region" : "aaa",
"availability_zone" : "bbb,ccc,ddd",
"vpc_id" : "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
"subnet_id" : "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
"security_group_id" : "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
"mode" : "Cluster",
"flavor" : [ {
"num" : 3,
"size" : 500,
"storage" : "ULTRAHIGH",
"spec_code" : "geminidb.cassandra.4xlarge.4"
} ],
"backup_strategy" : {
"start_time" : "08:15-09:15",
"keep_days" : "8"
},
"ssl_option" : "1",
"job_id" : "c010abd0-48cf-4fa8-8cbc-090f093eaa2f"
}
Status Codes
See Status Codes.
Error Codes
See Error Codes.