Restoring Data to a New instance
Function
This API is used to restore data to a new DB instance using backups. Before calling this API:
- Learn how to authenticate this API.
- Obtain the required region and endpoint.
Constraints
The DB engine versions and instance types of the original and new instances must be the same.
The specifications of the new instance must be greater than or equal to those of the original instance.
URI
POST https://{Endpoint}/v3/{project_id}/instances
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Explanation: Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. Restrictions: None Value range: The value can contain 32 characters. Only letters and digits are allowed. Default value: None |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
DB instance name. Instances of the same type can have same names under the same tenant. The name must consist of 4 to 64 characters and start with a letter. It can contain only letters (case-sensitive), digits, hyphens (-), and underscores (_). |
availability_zone |
Yes |
String |
AZ ID. The value cannot be empty. You can deploy GaussDB in the same AZ or across three different AZs, and use commas (,) to separate AZs. For example:
The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints. |
flavor_ref |
Yes |
String |
Specification code. The value cannot be empty. To obtain its value, see the spec_code field in Querying Instance Specifications. |
volume |
Yes |
Object |
Volume information. For details, see Table 3. |
disk_encryption_id |
No |
String |
Key ID for disk encryption. The default value is empty. |
vpc_id |
Yes |
String |
VPC ID. To obtain this parameter value, use the following methods:
|
subnet_id |
Yes |
String |
Network ID of the subnet. To obtain this parameter value, use either of the following methods:
|
security_group_id |
Yes |
String |
Security group which the instance is associated with. To obtain this parameter value, use either of the following methods:
|
password |
Yes |
String |
Database password. The GaussDB database password must: Consist of 8 to 32 characters, including at least three of the following: uppercase letters, lowercase letters, digits, and special characters ~!@#%^*-_=+?, Enter a strong password to improve security, preventing security risks such as brute force cracking. |
charge_info |
No |
Object |
Billing mode, which can be pay-per-use or yearly/monthly. For details, see Table 4. |
backup_strategy |
No |
Object |
Automated backup policy. For details, see Table 6. |
restore_point |
Yes |
Object |
Restoration information. For details, see Table 5. |
enable_parallel_restore |
No |
Boolean |
Whether to support parallel restoration. If this parameter is not specified, the function is not supported for instances of the enterprise edition, and supported for primary/standby instances by default. |
configuration_id |
No |
String |
Parameter template ID. If this parameter is not specified, the default parameter template is used. |
enterprise_project_id |
No |
String |
Enterprise project ID. |
port |
No |
String |
Port number used by the database to provide services for external systems, ranging from 1024 to 39998. If you do not configure this parameter, the default value 8000 is used. The following ports are not allowed: 2378, 2379, 2380, 4999, 5000, 5999, 6000, 6001, 8097, 8098, 12016, 12017, 20049, 20050, 21731, 21732, 32122, 32123, and 32124. |
time_zone |
No |
String |
UTC time zone.
|
enable_force_switch |
No |
Boolean |
Whether to forcibly promote a standby node to primary. The value can only be true or false. true: The function is enabled. false (default value): The function is disabled. Only 1.2.2 and later versions are supported.
NOTE:
The function is suitable for the following scenario: When the primary node is faulty, a standby node is forcibly promoted to primary to provide services, ensuring the instance availability. When the instance is faulty, this function is used to recover services as soon as possible at the cost of partial data loss. You are not advised to use this function if you are not clear about the impact of data loss on services. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
Disk type. LOCALSSD indicates the local SSD and is available for primary/standby instances. ULTRAHIGH indicates the cloud disk and is available for distributed instances in the independent deployment. The value is case-sensitive. ULTRAHIGH: local disk. ESSD: extreme SSD. |
size |
Yes |
Integer |
Storage space, which must be at least equal to that of the original instance. For example, if this parameter is set to 40, 40 GB of storage is allocated to the instance. ECS deployment: The value is from (Number of shards x 40 GB) to (Number of shards x 16 TB) and must be a multiple of (Number of shards x 4 GB). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
charge_mode |
Yes |
String |
Billing mode. postPaid: pay-per-use billing. prePaid: yearly/monthly billing. |
period_type |
No |
string |
Subscription period type. month: The service is subscribed by month. year: The service is subscribed by year. This parameter is valid and mandatory only when charge_mode is set to prePaid. |
period_num |
No |
integer |
This parameter is valid and mandatory only when charge_mode is set to prePaid. Value range: When period_type is set to month, the parameter value ranges from 1 to 9. When period_type is set to year, the parameter value ranges from 1 to 3. When a floating-point value is transferred, the value is automatically truncated to an integer. |
is_auto_renew |
No |
boolean |
Whether automatic renewal is enabled for yearly/monthly instances. If you enable this function, the order will be automatically paid during the subscription renewal. The default renewal period is one month for monthly subscription and one year for yearly subscription. The renewal period can be configured as needed. true: indicates that the subscription is automatically renewed. false: indicates that the subscription is not automatically renewed. The default value is false. |
is_auto_pay |
No |
boolean |
Whether the order will be automatically paid after yearly/monthly instances are created. This parameter does not affect the payment mode of automatic renewal. true: indicates that the order is automatically paid from the account. false: indicates that the order is manually paid from the account. The default value is false. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
instance_id |
Yes |
String |
Source instance ID. |
backup_id |
No |
String |
ID of the backup to be restored. |
type |
No |
String |
Restoration type. Value:
Value:
|
restore_time |
No |
Long |
Time point of data restoration in the UNIX timestamp format. The unit is millisecond and the time zone is UTC. |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
instance |
Object |
Instance information. For details, see Table 8. |
job_id |
String |
Task ID for restoring data to a new DB instance. |
order_id |
string |
ID of the order for creating an instance. This parameter is returned only when a yearly/monthly instance is created. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Instance ID. |
name |
String |
DB instance name. Instances of the same type can have same names under the same tenant. The name must consist of 4 to 64 characters and start with a letter. It can contain only letters (case-sensitive), digits, hyphens (-), and underscores (_). |
status |
String |
Instance status. For example, BUILD indicates that the instance is being created. |
datastore |
Object |
Database information. For details, see Table 9. |
ha |
Object |
Instance deployment model. For details, see Table 10. |
port |
String |
Database port. The default value is 8000. |
enterprise_project_id |
String |
Project ID. |
volume |
Object |
Volume information. For details, see Table 11. |
backup_strategy |
Object |
Automated backup policy. For details, see Table 12. |
replica_num |
Integer |
Number of replicas. |
region |
String |
Region ID. The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints. |
flavor_ref |
String |
Specification code. |
availability_zone |
String |
AZ ID. You can deploy your instance in the same AZ or across three different AZs, and use commas (,) to separate AZs. The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints. |
vpc_id |
String |
VPC ID. |
subnet_id |
String |
Subnet ID. |
security_group_id |
String |
Security group ID. |
charge_info |
Object |
Billing mode, which can be pay-per-use or yearly/monthly. For details, see Table 13. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
DB engine. Value:
|
version |
String |
DB engine version. |
Parameter |
Type |
Description |
---|---|---|
mode |
String |
For distributed instances, the return value is enterprise (enterprise edition). For primary/standby instances, the return value is centralization_standard (primary/standby edition). |
replication_mode |
String |
Replication mode for the standby node. The value can only be set to sync, indicating that data is synchronized in synchronous mode. |
consistency |
String |
(GaussDB reserved parameter) Transaction consistency type. The value can be strong or eventual. Value:
|
Parameter |
Type |
Description |
---|---|---|
type |
String |
Disk type. Its value is case-sensitive and can be:
Value:
|
size |
Integer |
Disk size. When restoring a distributed GaussDB instance, you need to specify the size to be a multiple of (Number of shards x 4 GB). Value range: (Number of shards x 40 GB) to (Number of shards x 16 TB). |
Parameter |
Type |
Description |
---|---|---|
start_time |
String |
This field has been deprecated. |
keep_days |
Integer |
This field has been deprecated. |
Parameter |
Type |
Description |
---|---|---|
charge_mode |
String |
Billing mode. postPaid: pay-per-use billing. prePaid: yearly/monthly billing. |
period_type |
string |
Subscription period type. month: The service is subscribed by month. year: The service is subscribed by year. This parameter is valid and mandatory only when charge_mode is set to prePaid. |
period_num |
integer |
This parameter is valid and mandatory only when charge_mode is set to prePaid. Value range: When period_type is set to month, the parameter value ranges from 1 to 9. When period_type is set to year, the parameter value ranges from 1 to 3. |
is_auto_renew |
boolean |
Whether automatic renewal is enabled for yearly/monthly instances. If you enable this function, the order will be automatically paid during the subscription renewal. The default renewal period is one month for monthly subscription and one year for yearly subscription. The renewal period can be configured as needed. true: indicates that the subscription is automatically renewed. false: indicates that the subscription is not automatically renewed. The default value is false. |
is_auto_pay |
boolean |
Whether the order will be automatically paid after yearly/monthly instances are created. This parameter does not affect the payment mode of automatic renewal. true: indicates that the order is automatically paid from the account. false (default value): indicates that the order is manually paid from the account. |
Example Request
- Restoring data to a new DB instance using backups. The new DB instance features 8 vCPUs, 64 GB memory, and 160 GB storage.
POST https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "targetInst", "availability_zone": "aaa,bbb,ccc", "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "volume": { "type": "ULTRAHIGH", "size": 160 }, "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "password": "******", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin14", "backup_id": "2f4ddb93b9014b0893d81d2e472f30febr14" }, "enable_parallel_restore": false, "configuration_id": "52e86e87445847a79bf807ceda213165pr01", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "port": 8000, "enable_force_switch": true, "time_zone": "UTC+04:00" }
- Restoring data to a new DB instance using backups. The new DB instance features 8 vCPUs, 64 GB memory, and 160 GB storage.
POST https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "targetInst", "availability_zone": "aaa,bbb,ccc", "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "volume": { "type": "ULTRAHIGH", "size": 160 }, "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "password": "******", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin14", "backup_id": "2f4ddb93b9014b0893d81d2e472f30febr14", "type": "backup" }, "enable_parallel_restore": false, "configuration_id": "52e86e87445847a79bf807ceda213165pr01", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "port": 8000, "enable_force_switch": true, "time_zone": "UTC+04:00" }
- Restoring data to a new DB instance using PITR. The new DB instance features 8 vCPUs, 64 GB memory, and 160 GB storage.
POST https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "targetInst", "availability_zone": "aaa,bbb,ccc", "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "volume": { "type": "ULTRAHIGH", "size": 160 }, "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "password": "******", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin14", "type": "timestamp", "restore_time": 1532001446987 }, "enable_parallel_restore": false, "configuration_id": "52e86e87445847a79bf807ceda213165pr01", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "port": 8000, "enable_force_switch": true, "time_zone": "UTC+04:00" }
Response
{
"instance": {
"id": "2gfdsh844a4023a776fc5c5fb71fb4in14",
"name": "gaussdb-instance-rep2",
"status": "BUILD",
"datastore": {
"type": "GaussDB",
"version": "1.4"
},
"ha": {
"mode": "enterprise",
"consistency": "strong",
"replication_mode": "sync"
},
"volume": {
"type": "ULTRAHIGH",
"size": 160
},
"port": "8000",
"replica_num": 3,
"region": "regionA",
"enable_parallel_restore": false,
"flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in",
"availability_zone": "aaa,bbb,ccc",
"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
"charge_info": {
"charge_mode": "postPaid"
},
"enterprise_project_id": "fdsa-3rds",
},
"job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d"
}
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot