华为云用户手册

  • Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdbss.v1.region.dbss_region import DbssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdbss.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = DbssClient.new_builder() \ .with_credentials(credentials) \ .with_region(DbssRegion.value_of("cn-north-4")) \ .build() try: request = ShowAuditQuotaRequest() response = client.show_audit_quota(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 audit_quota Long 实例当前剩余配额。 cpu Long Cpu当前剩余配额。 project_id String 项目Id。 quota Long 配额。 ram Long 内存当前剩余配额 状态码: 400 表4 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表5 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表6 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表7 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表8 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表9 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • AK/SK认证 AK/SK签名认证方式仅支持消息体大小12MB以内,12MB以上的请求请使用Token认证。 AK/SK认证就是使用AK/SK对请求进行签名,在请求时将签名信息添加到消息头,从而通过身份认证。 AK(Access Key ID):访问密钥ID。与私有访问密钥关联的唯一标识符;访问密钥ID和私有访问密钥一起使用,对请求进行加密签名。 SK(Secret Access Key):与访问密钥ID结合使用的密钥,对请求进行加密签名,可标识发送方,并防止请求被修改。 使用AK/SK认证时,您可以基于签名算法使用AK/SK对请求进行签名,也可以使用专门的签名SDK对请求进行签名。详细的签名方法和SDK使用方法请参见API签名指南。 签名SDK只提供签名功能,与服务提供的SDK不同,使用时请注意。
  • Token认证 Token的有效期为24小时,需要使用一个Token鉴权时,可以先缓存起来,避免频繁调用。 Token在计算机系统中代表令牌(临时)的意思,拥有Token就代表拥有某种权限。Token认证就是在调用API的时候将Token加到请求消息头,从而通过身份认证,获得操作API的权限。 Token可通过调用获取用户Token接口获取,调用本服务API需要project级别的Token,即调用获取用户Token接口时,请求body中auth.scope的取值需要选择project,如下所示。 { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "********", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "xxxxxxxx" } } } } 获取Token后,再调用其他接口时,您需要在请求消息头中添加“X-Auth-Token”,其值即为Token。例如Token值为“ABCDEFJ....”,则调用接口时将“X-Auth-Token: ABCDEFJ....”加到请求消息头即可,如下所示。 Content-Type: application/json X-Auth-Token: ABCDEFJ....
  • 基本概念 账号 用户注册时的账号,账号对其所拥有的资源及云服务具有完全的访问权限,可以重置用户密码、分配用户权限等。由于账号是付费主体,为了确保账号安全,建议您不要直接使用账号进行日常管理工作,而是创建用户并使用创建的用户进行日常管理工作。 用户 由账号在IAM中创建的用户,是云服务的使用人员,具有身份凭证(密码和访问密钥)。 通常在调用API的鉴权过程中,您需要用到账号、用户和密码等信息。 区域(Region) 从地理位置和网络时延维度划分,同一个Region内共享弹性计算、块存储、对象存储、VPC网络、弹性公网IP、镜像等公共服务。Region分为通用Region和专属Region,通用Region指面向公共租户提供通用云服务的Region;专属Region指只承载同一类业务或只面向特定租户提供业务服务的专用Region。 详情请参见区域和可用区。 可用区(AZ,Availability Zone) 一个AZ是一个或多个物理数据中心的集合,有独立的风火水电,AZ内逻辑上再将计算、网络、存储等资源划分成多个集群。一个Region中的多个AZ间通过高速光纤相连,以满足用户跨AZ构建高可用性系统的需求。 项目 区域默认对应一个项目,这个项目由系统预置,用来隔离物理区域间的资源(计算资源、存储资源和网络资源),以默认项目为单位进行授权,用户可以访问您账号中该区域的所有资源。如果您希望进行更加精细的权限控制,可以在区域默认的项目中创建子项目,并在子项目中创建资源,然后以子项目为单位进行授权,使得用户仅能访问特定子项目中资源,使得资源的权限控制更加精确。 图1 项目隔离模型 父主题: 使用前必读
  • Go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dbss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := dbss.NewDbssClient( dbss.DbssClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.CreateInstancesPeriodOrderRequest{} var listTagsbody = []model.KeyValueBean{ { Key: "key_test", Value: "1", }, } var listProductInfosbody = []model.CreateInstancePeriodRequestProductInfos{ { ProductId: "00301-225396-0--0", CloudServiceType: "hws.service.type.dbss", ResourceType: "hws.resource.type.dbss", ResourceSpecCode: "dbss.bypassaudit.low", ProductSpecDesc: "test", }, } var listSecurityGroupsbody = []model.CreateInstancePeriodRequestSecurityGroups{ { Id: "04088976-9c63-4e6b-9070-84e6a30c782b", }, } var listNicsbody = []model.CreateInstancePeriodRequestNics{ { SubnetId: "6201dcf2-1374-43ec-ae8b-78b4081572d3", }, } isAutoRenewCreateInstancePeriodRequest:= int32(0) promotionInfoCreateInstancePeriodRequest:= "" commentCreateInstancePeriodRequest:= "" request.Body = &model.CreateInstancePeriodRequest{ IsAutoRenew: &isAutoRenewCreateInstancePeriodRequest, PromotionInfo: &promotionInfoCreateInstancePeriodRequest, Tags: &listTagsbody, ProductInfos: listProductInfosbody, SubscriptionNum: int32(1), PeriodNum: int32(1), PeriodType: int32(2), ChargingMode: int32(0), CloudServiceType: "hws.service.type.dbss", Region: "cn-north-7", Comment: &commentCreateInstancePeriodRequest, SecurityGroups: listSecurityGroupsbody, Nics: listNicsbody, EnterpriseProjectId: "0", AvailabilityZone: "cn-north-7c", VpcId: "4c035747-f77b-4c6d-b23b-cb3a2b96c7e6", Name: "DBSS-acc3", FlavorRef: "st6.xlarge.4", } response, err := client.CreateInstancesPeriodOrder(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求示例 创建一个包周期计费"chargin_mode : 0"的实例,版本为基础版:"resource_spec_code" : "dbss.bypassaudit.low"。 /v2/{project_id}/dbss/audit/charge/period/order { "flavor_ref" : "st6.xlarge.4", "name" : "DBSS-acc3", "vpc_id" : "4c035747-f77b-4c6d-b23b-cb3a2b96c7e6", "availability_zone" : "cn-north-7c", "comment" : "", "region" : "cn-north-7", "nics" : [ { "subnet_id" : "6201dcf2-1374-43ec-ae8b-78b4081572d3" } ], "security_groups" : [ { "id" : "04088976-9c63-4e6b-9070-84e6a30c782b" } ], "cloud_service_type" : "hws.service.type.dbss", "charging_mode" : 0, "period_type" : 2, "period_num" : 1, "subscription_num" : 1, "is_auto_renew" : 0, "product_infos" : [ { "product_id" : "00301-225396-0--0", "cloud_service_type" : "hws.service.type.dbss", "resource_type" : "hws.resource.type.dbss", "resource_spec_code" : "dbss.bypassaudit.low", "product_spec_desc" : "{\"specDesc\":{\"zh-cn\":{\"key1\":\"value1\"},\"en-us\":{\"key1\":\"value1\"}}}" } ], "promotion_info" : "", "enterprise_project_id" : "0", "tags" : [ { "key" : "key_test", "value" : "1" } ] } 创建一个包周期计费"chargin_mode : 0"的实例,版本为专业版:"resource_spec_code" : "dbss.bypassaudit.medium"。 { "flavor_ref": "c6.2xlarge.2", "name": "DBSS-test", "vpc_id": "4c035747-f77b-4c6d-b23b-cb3a2b96c7e6", "availability_zone": "cn-north-7b", "comment": "", "region": "cn-north-7", "nics": [ { "subnet_id": "6201dcf2-1374-43ec-ae8b-78b4081572d3" } ], "security_groups": [ { "id": "59c45017-a484-481b-8440-18c2214ccb06" } ], "cloud_service_type": "hws.service.type.dbss", "charging_mode": 0, "period_type": 2, "period_num": 1, "subscription_num": 1, "is_auto_renew": 0, "product_infos": [ { "product_id": "00301-225396-0--0", "cloud_service_type": "hws.service.type.dbss", "resource_type": "hws.resource.type.dbss", "resource_spec_code": "dbss.bypassaudit.medium", "product_spec_desc": "{\"specDesc\":{\"zh-cn\":{\"key1\":\"value1\"},\"en-us\":{\"key1\":\"value1\"}}}" } ], "promotion_info": "", "enterprise_project_id": "0" }
  • Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdbss.v1.region.dbss_region import DbssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdbss.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = DbssClient.new_builder() \ .with_credentials(credentials) \ .with_region(DbssRegion.value_of("cn-north-4")) \ .build() try: request = CreateInstancesPeriodOrderRequest() listTagsbody = [ KeyValueBean( key="key_test", value="1" ) ] listProductInfosbody = [ CreateInstancePeriodRequestProductInfos( product_id="00301-225396-0--0", cloud_service_type="hws.service.type.dbss", resource_type="hws.resource.type.dbss", resource_spec_code="dbss.bypassaudit.low", product_spec_desc="test" ) ] listSecurityGroupsbody = [ CreateInstancePeriodRequestSecurityGroups( id="04088976-9c63-4e6b-9070-84e6a30c782b" ) ] listNicsbody = [ CreateInstancePeriodRequestNics( subnet_id="6201dcf2-1374-43ec-ae8b-78b4081572d3" ) ] request.body = CreateInstancePeriodRequest( is_auto_renew=0, promotion_info="", tags=listTagsbody, product_infos=listProductInfosbody, subscription_num=1, period_num=1, period_type=2, charging_mode=0, cloud_service_type="hws.service.type.dbss", region="cn-north-7", comment="", security_groups=listSecurityGroupsbody, nics=listNicsbody, enterprise_project_id="0", availability_zone="cn-north-7c", vpc_id="4c035747-f77b-4c6d-b23b-cb3a2b96c7e6", name="DBSS-acc3", flavor_ref="st6.xlarge.4" ) response = client.create_instances_period_order(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 响应参数 状态码: 200 表8 响应Body参数 参数 参数类型 描述 description String 描述 code String 返回码 order_id String 订单ID 状态码: 400 表9 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表10 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表11 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表12 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表13 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表14 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token 表3 请求Body参数 参数 是否必选 参数类型 描述 flavor_ref 是 String 云服务器使用的规格ID name 是 String 云服务器名称。 取值范围: 只能由中文字符、英文字母、数字、下划线、中划线组成,且长度小于等于64个字符。 创建的云服务器数量大于1时,长度小于等于59个字符 vpc_id 是 String VPC的ID availability_zone 是 String 云服务器对应可用分区信息。(两个主备分区,中间用“,”分割,例如az1.dc1,az2.dc2) enterprise_project_id 是 String 企业项目ID nics 是 Array of nics objects 云服务器对应的网卡信息 security_groups 是 Array of security_groups objects 云服务器对应安全组信息 comment 否 String 备注信息 region 是 String 云服务器所在区域ID cloud_service_type 是 String 服务类型: 默认hws.service.type.dbss charging_mode 是 Integer 计费模式: 0:包周期计费 1:按需计费 period_type 是 Integer 订购周期类型: 0:天; 1:周; 2:月; 3:年; 4:小时; 5:绝对时间 period_num 是 Integer 订购周期数 subscription_num 是 Integer 订购数量: DBSS只支持订购1套,不支持多套 product_infos 是 Array of product_infos objects 产品信息列表 tags 否 Array of KeyValueBean objects 资源标签 promotion_info 否 String 折扣信息 is_auto_renew 否 Integer 自动续费 1表示自动续费,0表示不自动续费 表4 nics 参数 是否必选 参数类型 描述 subnet_id 是 String 网卡对应的子网ID ip_address 否 String IP地址,不填或空字符串为自动分配 表5 security_groups 参数 是否必选 参数类型 描述 id 是 String 云服务器对应的安全组ID,会对创建云服务器中配置的网卡生效 表6 product_infos 参数 是否必选 参数类型 描述 product_id 是 String 产品ID cloud_service_type 是 String 服务类型: 默认hws.service.type.dbss resource_type 是 String 资源类型: 默认hws.resource.type.dbss resource_spec_code 是 String 资源规格:dbss.bypassaudit.low、dbss.bypassaudit.medium、dbss.bypassaudit.high product_spec_desc 是 String 产品规格描述, json字符串格式 :{"specDesc":{"zh-cn":{"key1":"value1"},"en-us":{"key1":"value1"}}} 表7 KeyValueBean 参数 是否必选 参数类型 描述 key 是 String 键 value 是 String 值
  • 响应示例 状态码: 200 成功 { "servers" : [ { "name" : "DBSS-Test", "comment" : "", "connect_ipv6" : null, "status" : "ACTIVE", "task" : "NO_TASK", "id" : "8c53ed03-8ed7-4ff2-ad97-7b2d6d1dd364", "specification" : "Low | 3 Proxy", "zone" : "cn-cmcc1a-01", "created" : "2021-04-21 04:37:54", "expired" : null, "subnet_id" : "97ef0bb5-3759-4db4-aa49-0d087ed49ce5", "cpu" : 4, "ram" : 16384, "region" : "cn-cmcc1", "version" : "21.04.16.164614", "charge_model" : "Demand", "remain_days" : null, "config_num" : 1, "effect" : null, "scene" : null, "connect_ip" : "192.168.0.229", "port_id" : "dc4bd420-e01c-4d12-a7ff-814f17c63079", "resource_id" : "062212d8-8e30-4783-9671-43f3f1f3bb1e", "vpc_id" : "76d98391-5abc-46ed-b8a8-f664202cb166", "security_group_id" : "f0fbec06-bcf6-4c7e-99fa-f0ddfbb1d9bd", "resource_spec_code" : "dbss.bypassaudit.low", "keep_days" : null, "new_version" : null, "database_limit" : 3 } ], "total" : 1 } 状态码: 400 失败 { "error" : { "error_code" : "DBSS.XXXX", "error_msg" : "XXX" } }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 servers Array of AuditInstanceListBean objects 实例信息列表 total Integer 总数 表5 AuditInstanceListBean 参数 参数类型 描述 charge_model String 付费模式 Period:包周期 Demand:按需。 comment String 备注信息。 config_num Integer 配置的数据库总数。 connect_ip String 连接地址。 connect_ipv6 String ipv6连接地址。 cpu Integer CPU个数 created String 创建时间 database_limit Integer 支持的数据库总数 effect Integer 1.冻结可释放 2.冻结不可释放 3.冻结后不可续费 expired String 过期时间 id String ID keep_days String 剩余天数 name String 实例别名 new_version String 如果有返回,则需要升级,如果没有,则为null port_id String 绑定弹性IP的portID ram Integer 内存 region String 实例所在region remain_days String 到期天数 resource_id String 资源ID resource_spec_code String 实例的规格 scene String 场景 security_group_id String 安全组 specification String 实例规格 status String 实例状态: SHUTOFF(已关闭) ACTIVE(运行中,允许任何操作) DELETING(删除中,不允许任何操作) BUILD(创建中,不允许任何操作) DELETED(已删除,不需要展示) ERROR(故障,只允许删除) HAWAIT(等待备机创建成功,不允许任何操作) FROZEN(已冻结,只允许续费、绑定/解绑) UPGRADING(升级中,不允许升级操作) subnet_id String 子网ID task String 任务状态: powering-on(正在开启,实例可以绑定、解绑) powering-off(正在关闭,实例可以绑定、解绑) rebooting(正在重启,实例可以绑定、解绑) delete_wait(等待删除,集群与实例不允许任何操作) NO_TASK(不展示) version String 实例的当前版本 vpc_id String 虚拟私有云 zone String 可用区 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表7 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表8 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表9 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表10 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表11 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • 响应示例 状态码: 200 成功 { "databases" : [ { "database" : { "id" : "zLKv83gBCwCqSg3BJt0m", "name" : "db01", "type" : "MYSQL", "version" : "5.0", "charset" : "UTF8", "ip" : "192.168.0.204", "port" : "3306", "os" : "LINUX64", "status" : "OFF", "instance_name" : "", "audit_status" : null, "agent_url" : [ "zrKw83gBCwCqSg3Bkt1P" ], "db_classification" : "ECS" } } ] } 状态码: 400 请求参数错误 { "error" : { "error_code" : "DBSS.XXXX", "error_msg" : "XXX" } } 状态码: 500 服务器内部错误 { "error" : { "error_code" : "DBSS.XXXX", "error_msg" : "XXX" } }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 databases Array of DataBaseBean objects 数据库信息列表 total Integer 总数 表5 DataBaseBean 参数 参数类型 描述 database DataBase object 数据库信息 表6 DataBase 参数 参数类型 描述 id String 数据库ID name String 数据库名称 type String 添加的数据库类型: 枚举值:  MYSQL  ORACLE  POSTGRESQL  SQLSERVER  DAMENG  TAURUS  DWS  KINGBASE  GAUSSDBOPENGAUSS  GREENPLUM  HIGHGO  SHENTONG  GBASE8A  GBASE8S  GBASEXDM  MONGODB  DDS version String 数据库版本 charset String 数据库字符集 ip String 数据库IP port String 数据库端口 os String 数据库操作系统 status String 开启状态(1:开启,0:关闭) instance_name String 数据库实例名 audit_status String 数据库的运行状态 枚举值:  ACTIVE  SHUTOFF  ERROR agent_url Array of strings agent的唯一ID db_classification String 数据库分类,取值范围: RDS(表示RDS数据库)和 ECS(自建数据库) 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表8 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表9 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表10 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表11 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表12 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • URI GET /v1/{project_id}/{instance_id}/dbss/audit/databases 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID instance_id 是 String 实例ID 表2 Query参数 参数 是否必选 参数类型 描述 status 否 String 实例状态 ON :开启 OFF : 关闭 offset 否 String 偏移量 limit 否 String 查询记录数
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 result String 响应状态 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表6 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表7 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表8 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表9 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表10 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdbss.v1.region.dbss_region import DbssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdbss.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = DbssClient.new_builder() \ .with_credentials(credentials) \ .with_region(DbssRegion.value_of("cn-north-4")) \ .build() try: request = UpdateAuditSecurityGroupRequest() listSecuritygroupIdsbody = [ "f0fbec06-bcf6-4c7e-99fa-f0ddfbb1d9bd" ] request.body = SecurityGroupRequest( securitygroup_ids=listSecuritygroupIdsbody, resource_id="062212d8-8e30-4783-9671-43f3f1f3bb1e" ) response = client.update_audit_security_group(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • Go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dbss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := dbss.NewDbssClient( dbss.DbssClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdateAuditSecurityGroupRequest{} var listSecuritygroupIdsbody = []string{ "f0fbec06-bcf6-4c7e-99fa-f0ddfbb1d9bd", } request.Body = &model.SecurityGroupRequest{ SecuritygroupIds: listSecuritygroupIdsbody, ResourceId: "062212d8-8e30-4783-9671-43f3f1f3bb1e", } response, err := client.UpdateAuditSecurityGroup(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dbss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dbss/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := dbss.NewDbssClient( dbss.DbssClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.AddRdsNoAgentDatabaseRequest{} enterpriseNameDatabases:= "default" enterpriseNameDatabases1:= "default" var listDatabasesbody = []model.RdsNoAgentDbRequestDatabases{ { Id: "123751d3ee2f47aea64822e98318c6a8in01", DbName: "rds1", Status: "ACTIVE", Port: "3306", Ip: "192.168.0.119", InstanceName: "rds1", Version: "8.0", Type: "MySQL", EnterpriseId: "0", EnterpriseName: &enterpriseNameDatabases, }, { Id: "2343f7285d684fed8b09fac201c3fc7ain01", DbName: "rds2", Status: "ACTIVE", Port: "3306", Ip: "192.168.0.92", InstanceName: "rds2", Version: "8.0", Type: "MySQL", EnterpriseId: "0", EnterpriseName: &enterpriseNameDatabases1, }, } request.Body = &model.RdsNoAgentDbRequest{ Databases: listDatabasesbody, } response, err := client.AddRdsNoAgentDatabase(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求示例 /v1/{project_id}/{instance_id}/dbss/audit/databases/rds { "databases" : [ { "id" : "123751d3ee2f47aea64822e98318c6a8in01", "db_name" : "rds1", "status" : "ACTIVE", "port" : "3306", "ip" : "192.168.0.119", "instance_name" : "rds1", "version" : "8.0", "type" : "MySQL", "enterprise_id" : "0", "enterprise_name" : "default" }, { "id" : "2343f7285d684fed8b09fac201c3fc7ain01", "db_name" : "rds2", "status" : "ACTIVE", "port" : "3306", "ip" : "192.168.0.92", "instance_name" : "rds2", "version" : "8.0", "type" : "MySQL", "enterprise_id" : "0", "enterprise_name" : "default" } ] }
  • Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdbss.v1.region.dbss_region import DbssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdbss.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = DbssClient.new_builder() \ .with_credentials(credentials) \ .with_region(DbssRegion.value_of("cn-north-4")) \ .build() try: request = AddRdsNoAgentDatabaseRequest() listDatabasesbody = [ RdsNoAgentDbRequestDatabases( id="123751d3ee2f47aea64822e98318c6a8in01", db_name="rds1", status="ACTIVE", port="3306", ip="192.168.0.119", instance_name="rds1", version="8.0", type="MySQL", enterprise_id="0", enterprise_name="default" ), RdsNoAgentDbRequestDatabases( id="2343f7285d684fed8b09fac201c3fc7ain01", db_name="rds2", status="ACTIVE", port="3306", ip="192.168.0.92", instance_name="rds2", version="8.0", type="MySQL", enterprise_id="0", enterprise_name="default" ) ] request.body = RdsNoAgentDbRequest( databases=listDatabasesbody ) response = client.add_rds_no_agent_database(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 illegal_db_id Array of strings 添加失败的数据库实例id legal_db_id Array of strings 添加成功的数据库实例id 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表7 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 403 表8 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表9 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。 状态码: 500 表10 响应Body参数 参数 参数类型 描述 error Object 错误信息返回体。 表11 ErrorDetail 参数 参数类型 描述 error_code String 错误请求返回的错误码。 error_msg String 错误请求返回的错误信息。
  • 响应示例 状态码: 200 成功 { "illegal_db_id" : [ ], "legal_db_id" : [ "123751d3ee2f47aea64822e98318c6a8in01", "2343f7285d684fed8b09fac201c3fc7ain01" ] } 状态码: 400 失败 { "error" : { "error_code" : "DBSS.XXXX", "error_msg" : "XXX" } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token 表3 请求Body参数 参数 是否必选 参数类型 描述 databases 是 Array of databases objects 添加数据库信息列表 total_count 否 Integer 总数 表4 databases 参数 是否必选 参数类型 描述 id 是 String 数据库ID db_name 是 String 数据库名称 status 是 String 数据库状态 port 是 String 数据库端口 ip 是 String 数据库IP instance_name 是 String 数据库实例名称 version 是 String 数据库版本 type 是 String 数据库类型 enterprise_id 是 String 企业项目ID enterprise_name 否 String 企业项目名称
  • 请求示例 使用备份文件将数据恢复到实例。 POST https://{endpoint}/v3.1/0483b6b16e954cb88930a360d2c4e663/instances/recovery { "source": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "backup", "backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe" }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01" } } 使用SQL Server备份文件将所有数据库恢复到实例。 { "source": { "instance_id": "61879e6085bc44d1831b0ce62d988fd9in04", "type": "backup", "backup_id": "b021670e69ba4538b7b2ed07257306aebr04", "restore_all_database":true }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04" } } 将实例的数据恢复到指定时间点。 { "source": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "timestamp", "restore_time": 1532001446987 }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01" } } 将SQL Server实例的部分数据库恢复到指定时间点。 { "source": { "instance_id": "61879e6085bc44d1831b0ce62d988fd9in04", "type": "timestamp", "restore_time": 1532001446987, "database_name": { "db1": "dbtest1,dbtest2", "db2": "db2,db02", "db3": "" } }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04" } }
  • 响应消息 正常响应要素说明 表12 要素说明 名称 参数类型 说明 instance Object 实例信息。 详情请参见表13。 job_id String 实例创建的任务id。仅按需实例时返回该参数。 order_id String 订单号,仅RDS for SQL Server创建包年包月时返回该参数。 表13 instance说明 名称 参数类型 说明 id String 实例ID。 name String 实例名称。 用于表示实例的名称,同一租户下,同类型的实例名可重名,其中,RDS for SQL Server实例名唯一。 status String 实例状态。如BUILD,表示创建中。 datastore Object 数据库信息。 详情请参见表14。 ha Object HA配置参数,仅当您选择创建HA实例时该参数才可见。 详情请参见表15。 configuration_id String 参数模板id,仅当您创建实例指定用户自定义参数组时才可见。 port String 数据库端口信息。 RDS for MySQL数据库端口设置范围为1024~65535(其中12017和33071被RDS系统占用不可设置)。 RDS for PostgreSQL数据库端口修改范围为2100~9500。 对于RDS for SQL Server 2022 EE、2022 SE、2022 Web版、2019 EE、2019 SE、2019 Web版、2017 EE、2017 SE、2017 Web版:端口设置范围为1433和2100~9500(其中5050、5353、5355、5985和5986不可设置)。 除此之外的其他版本:端口设置范围为1433和2100~9500(其中5355、5985和5986不可设置)。 当不传该参数时,默认端口如下: RDS for MySQL默认3306。 RDS for PostgreSQL默认5432。 RDS for SQL Server默认1433。 backup_strategy Object 自动备份策略。 详情请参见表16。 enterprise_project_tag String 项目标签。 flavor_ref String 规格ID。 使用可参考查询数据库规格响应消息表3中的“spec_code”。 volume Object volume信息。 详情请参见表17。 region String 区域ID。 availability_zone String 可用区ID。 vpc_id String 虚拟私有云ID,获取方法如下: 方法1:登录虚拟私有云服务的控制台界面,在虚拟私有云的详情页面查找VPC ID。 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考查询VPC列表。 subnet_id String 子网的网络ID信息,获取方法如下: 方法1:登录虚拟私有云服务的控制台界面,单击VPC下的子网,进入子网详情页面,查找网络ID。 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考查询子网列表。 security_group_id String 指定实例所属的安全组。 方法1:登录虚拟私有云服务的控制台界面,在安全组的详情页面查找安全组ID。 方法2:通过虚拟私有云服务的API接口查询,具体操作可参考查询安全组列表。 collation String RDS for SQL Server设定的字符集信息。 charge_info Object 计费方式信息,支持包年/包月和按需。 详情请参见表10。 表14 datastore字段数据结构说明 名称 是否必选 参数类型 说明 type 是 String 数据库引擎。支持的引擎如下,不区分大小写: MySQL PostgreSQL SQLServer version 是 String 数据库版本。 数据库支持的详细版本信息,可调用查询数据库引擎的版本接口获取。 complete_version 否 String 数据库完整版本号。仅在数据库引擎是”PostgreSQL”时返回。 表15 ha字段数据结构说明 名称 是否必选 参数类型 说明 mode 是 String 实例主备模式,取值:Ha。 replication_mode 是 String 备机同步参数。 取值:非空。 MySQL为“async”或“semisync”。 PostgreSQL为“async”或“sync”。 Microsoft SQL Server为“sync”。 说明: “async”为异步模式。 “semisync”为半同步模式。 “sync”为同步模式。 表16 backupStrategy字段数据结构说明 名称 是否必选 参数类型 说明 start_time 是 String 备份时间段。自动备份将在该时间段内触发。 取值范围:非空,格式必须为hh:mm-HH:MM且有效,当前时间指UTC时间。 HH取值必须比hh大1。 mm和MM取值必须相同,且取值必须为00、15、30或45。 取值示例: 08:15-09:15 23:00-00:00 keep_days 否 Integer 指定已生成备份文件的可保存天数。 取值范围:0~732。该参数缺省,或取0值,表示关闭自动备份策略。如果需要延长保留时间请联系客服人员申请,自动备份最长可以保留2562天。 表17 volume字段数据结构说明 名称 是否必选 参数类型 说明 type 是 String 磁盘类型。 取值范围如下,区分大小写: ULTRAHIGH,表示超高IO型磁盘。 LOCALSSD,表示本地SSD盘。 CLOUDSSD,表示SSD云盘。 ESSD,表示极速型SSD。 size 是 Integer 磁盘大小。 取值范围:40GB~4000GB。必须为10的整数倍。 正常响应样例 MySQL { "instance": { "id": "f5ffdd8b1c98434385eb001904209eacin01", "name": "demoname", "status": "BUILD", "datastore": { "type": "MySQL", "version": "5.7.31" }, "port": "3306", "volume": { "type": "ULTRAHIGH", "size": "40" }, "region": "aaa", "backup_strategy": { "start_time": "02:00-03:00", "keep_days": "7" }, "flavor_ref": "rds.mysql.s1.large", "availability_zone": "bbb", "vpc_id": "19e5d45d-70fd-4a91-87e9-b27e71c9891f", "subnet_id": "bd51fb45-2dcb-4296-8783-8623bfe89bb7", "security_group_id": "23fd0cd4-15dc-4d65-bdb3-8844cc291be0" }, "job_id": "bf003379-afea-4aa5-aa83-4543542070bc" } PostgreSQL { "instance": { "id": "f5ffdd8b1c98434385eb001904209eacin01", "name": "demoname", "status": "BUILD", "datastore": { "type": "PostgreSQL", "version": "9.6.13" }, "port": "5432", "volume": { "type": "ULTRAHIGH", "size": "40" }, "region": "aaa", "backup_strategy": { "start_time": "02:00-03:00", "keep_days": "7" }, "flavor_ref": "rds.pg.s1.large", "availability_zone": "bbb", "vpc_id": "19e5d45d-70fd-4a91-87e9-b27e71c9891f", "subnet_id": "bd51fb45-2dcb-4296-8783-8623bfe89bb7", "security_group_id": "23fd0cd4-15dc-4d65-bdb3-8844cc291be0" }, "job_id": "bf003379-afea-4aa5-aa83-4543542070bc" } SQL Server { "instance": { "id": "f5ffdd8b1c98434385eb001904209eacin01", "name": "demoname", "status": "BUILD", "datastore": { "type": "sqlserver", "version": "2014_SE" }, "port": "2100", "volume": { "type": "ULTRAHIGH", "size": "40" }, "region": "aaa", "backup_strategy": { "start_time": "02:00-03:00", "keep_days": "7" }, "flavor_ref": "rds.mssql.2014.se.s3.large.2", "availability_zone": "bbb", "vpc_id": "19e5d45d-70fd-4a91-87e9-b27e71c9891f", "subnet_id": "bd51fb45-2dcb-4296-8783-8623bfe89bb7", "security_group_id": "23fd0cd4-15dc-4d65-bdb3-8844cc291be0", "charge_info": { "charge_mode": "prePaid", "period_num": 1 }, "collation": "Cyrillic_General_CI_AS" }, "order_id": "CS20122919584LQ7K" } Serverless型MySQL { "instance": { "id": "dbb35f31f4144086bf522ff8a124530din01", "name": "serverless", "status": "BUILD", "datastore": { "type": "MySQL", "version": "5.7.41" }, "ha": { "mode": "Ha", "replication_mode": "semisync" }, "port": "3307", "volume": { "type": "CLOUDSSD", "size": 100 }, "region": "aaa", "backup_strategy": { "start_time": "08:15-09:15", "keep_days": 12 }, "flavor_ref": "rds.mysql.serverless.ha", "availability_zone": "bbb,ccc", "vpc_id": "bd3e4c67-74da-459d-820f-9fecd4ea9ca4", "subnet_id": "53cdf568-6f56-4944-a996-4afcaffe994e", "security_group_id": "89f258c5-4b81-4ef0-be30-34f2ee07dd1c" }, "job_id": "908c05f7-958a-4411-b590-890eed175345" } 异常响应 请参见异常请求结果。
  • 接口约束 源实例和目标实例的数据库类型必须一致,如都是MySQL。 源实例和目标实例的数据库版本约束如下: RDS for MySQL和RDS for PostgreSQL的源实例和目标实例的数据库版本必须一致。 RDS for SQL Server的源实例和目标实例的数据库版本约束参见表5。 RDS for MySQL和RDS for PostgreSQL数据库目标实例需大于或等于源实例的数据卷总大小。
  • 请求示例 将MySQL备份文件恢复到新实例。 POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "targetInst", "availability_zone": "bbb,ccc", "ha": { "mode": "ha", "replication_mode": "async" }, "flavor_ref": "rds.mysql.s1.large", "volume": { "type": "ULTRAHIGH", "size": 40 }, "region": "aaa", "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "data_vip": "192.168.0.147", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "backup_strategy": { "keep_days": 2, "start_time": "19:00-20:00" }, "password": "Demo@12345678", "configuration_id": "52e86e87445847a79bf807ceda213165pr01", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "time_zone": "UTC+04:00", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "backup", "backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe" } } 将SQL Server备份文件中的部分数据库恢复到新实例。 { "name": "targetInst", "datastore": { "type": "SQLServer", "version": "2014_SE" }, "availability_zone": "bbb,ccc", "ha": { "mode": "ha", "replication_mode": "sync" }, "flavor_ref": "rds.mssql.2014.se.s3.xlarge.2.ha", "volume": { "type": "ULTRAHIGH", "size": 40 }, "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "data_vip": "192.168.0.147", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "backup_strategy": { "keep_days": 2, "start_time": "19:00-20:00" }, "charge_info": { "charge_mode": "prePaid", "period_type": "month", "period_num": 1, "is_auto_renew": false, "is_auto_pay": true }, "password": "Demo@12345678", "configuration_id": "52e86e87445847a79bf807ceda213165pr04", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "time_zone": "UTC+04:00", "collation": "Cyrillic_General_CI_AS", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04", "type": "backup", "backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe", "database_name": { "db1": "dbtest1,dbtest2", "db2": "db2,db002", "db3": "" } } } 将MySQL实例的数据恢复到指定时间点。 { "name": "targetInst", "availability_zone": "bbb,ccc", "ha": { "mode": "ha", "replication_mode": "async" }, "flavor_ref": "rds.mysql.s1.large", "volume": { "type": "ULTRAHIGH", "size": 40 }, "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", "data_vip": "192.168.0.147", "backup_strategy": { "keep_days": 2, "start_time": "19:00-20:00" }, "password": "Demo@12345678", "configuration_id": "52e86e87445847a79bf807ceda213165pr01", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "time_zone": "UTC+04:00", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "timestamp", "restore_time": 1532001446987 } } 将SQL Server实例的部分数据库恢复到指定时间点。 { "name": "targetInst", "datastore": { "type": "SQLServer", "version": "2014_SE" }, "availability_zone": "bbb,ccc", "ha": { "mode": "ha", "replication_mode": "sync" }, "flavor_ref": "rds.mssql.2014.se.s3.xlarge.2.ha", "volume": { "type": "ULTRAHIGH", "size": 40 }, "disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4", "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f", "data_vip": "192.168.0.147", "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", "backup_strategy": { "keep_days": 2, "start_time": "19:00-20:00" }, "charge_info": { "charge_mode": "prePaid", "period_type": "month", "period_num": 1, "is_auto_renew": false, "is_auto_pay": true }, "password": "Demo@12345678", "configuration_id": "52e86e87445847a79bf807ceda213165pr04", "enterprise_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c", "time_zone": "UTC+04:00", "collation": "Cyrillic_General_CI_AS", "restore_point": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04", "type": "timestamp", "restore_time": 1532001446987, "database_name": { "db1": "dbtest1,dbtest2", "db2": "db2,db02", "db3": "" } } } 将Serverless型MySQL备份文件恢复到新实例。 { "name": "serverless", "datastore": { "type": "MySQL", "version": "5.7" }, "ha": { "mode": "ha", "replication_mode": "semisync" }, "flavor_ref": "rds.mysql.serverless.ha", "volume": { "type": "CLOUDSSD", "size": 100 }, "region": "aaa", "availability_zone": "bbb,ccc", "vpc_id": "bd3e4c67-74da-459d-820f-9fecd4ea9ca4", "subnet_id": "53cdf568-6f56-4944-a996-4afcaffe994e", "security_group_id": "89f258c5-4b81-4ef0-be30-34f2ee07dd1c", "port": 3307, "backup_strategy": { "start_time": "08:15-09:15", "keep_days": 12 }, "password": "****", "time_zone": "UTC+08:00", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" } ], "dry_run": false, "serverless_info": { "min_cap": "0.5", "max_cap": "1" }, "restore_point": { "instance_id": "aceb1e359a444660bb8fe0696afc76e1in01", "type": "backup", "backup_id": "0db0b4b93e5d40afbd65ede29153dc46br01" } }
  • 约束限制 账户余额大于等于0元,才可恢复到新实例。新实例将作为用户新创建的实例进行收费。 恢复到当前实例的限制: 如需恢复到当前实例,请提交工单联系客服人员开通权限。 如果备份所在的数据库实例已被删除,则不可恢复到当前实例。 请确保原实例及目标实例的时区配置完全一致,否则会有数据不一致风险。 若目标数据库已存在,恢复到当前实例会导致目标数据库的全部数据被覆盖,并且正在恢复过程中的数据库不可用。 恢复到已有实例的限制: 恢复到已有实例会导致实例数据被覆盖,且恢复过程中实例将不可用。 只可选择与原实例相同VPC,相同引擎,相同版本或高版本的实例。 请确保目标实例的存储空间大于或等于当前实例的存储空间,否则会导致任务下发失败。 请确保原实例及目标实例的时区配置完全一致,否则会有数据不一致风险。 如果原实例开启TDE,不允许恢复到已有实例。
  • 常见问题 如果执行存储过程发生报错,报错信息为“文件正在使用中”,则请稍后再执行存储过程。 如果执行存储过程后,日志文件大小未改变,请在目标数据库环境下,执行以下SQL,验证文件是否有足够的可用空间。 SELECT name, size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB FROM sys.database_files WHERE type_desc='LOG';
共100000条