云服务器内容精选

  • URI GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/databases 表1 参数说明 参数 是否必选 参数类型 描述 project_id 是 String 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 instance_id 是 String 实例ID。 offset 否 Integer 分页符。从第一条数据偏移offset页数据后开始查询,默认为0(偏移0页数据,表示从第一条数据开始查询),必须为数字,不能为负数。例如:该参数指定为1,limit指定为10,则只展示第11~20条数据。 limit 否 Integer 每页显示的条目数量,取值范围[1, 100],默认10。
  • 响应示例 查询数据库列表成功。 { "databases": [ { "name": "gaussdb_test", "owner": "root", "size": "25 MB", "datctype": "en_US.UTF-8", "character_set": "UTF8", "collate_set": "en_US.UTF-8", "compatibility_type": "GaussDB" }, { "name": "gaussdb_test1", "owner": "root", "size": "25 MB", "datctype": "en_US.UTF-8", "character_set": "UTF8", "collate_set": "en_US.UTF-8", "compatibility_type": "GaussDB" }, { "name": "gaussdb_test2", "owner": "root", "size": "25 MB", "datctype": "en_US.UTF-8", "character_set": "UTF8", "collate_set": "en_US.UTF-8", "compatibility_type": "GaussDB" } ], "total_count": 3 }
  • 响应参数 表2 参数说明 参数 参数类型 描述 databases Array of objects 列表中每个元素表示一个数据库。详情参见表3。 total_count Integer 总记录数。 表3 databases字段数据结构说明 参数 参数类型 描述 name String 数据库名称。 owner String 数据库所属用户。 character_set String 数据库使用的字符集,例如UTF8。 collate_set String 数据库排序集,例如en_US.UTF-8等。 size String 数据库大小。 datctype String 数据库使用的字符分类,例如en_US.UTF-8等。 compatibility_type String 数据库兼容的类型,如GaussDB,M。
  • 响应示例 查询实例组件列表成功。 { "nodes": [ { "components": [ { "id": "cm_1", "role": "master", "status": "Primary", "distributed_id": "", "type" : "CM", "detail" : "" }, { "id": "etcd_7001", "role": "master", "status": "StateLeader", "distributed_id": "", "type" : "ETCD", "detail" : "" }, { "id": "dn_6001", "role": "master", "status": "Primary", "distributed_id": "60011", "type" : "DN", "detail" : "Normal" } ], "id": "7d19f72f8f514564bd92962a6fbddb7dno14", "name": "gauss-9e1a_root_0", "availability_zone_id": "cn-southwest-244a", "description": "az1", "status": "normal" }, { "components": [ { "id": "cm_3", "role": "slave", "status": "Standby", "distributed_id": "", "type" : "CM", "detail" : "" }, { "id": "etcd_7003", "role": "slave", "status": "StateFollower", "distributed_id": "", "type" : "ETCD", "detail" : "" }, { "id": "dn_6003", "role": "slave", "status": "Standby", "distributed_id": "60011", "type" : "DN", "detail" : "Normal" } ], "id": "aafc2e14234d4c9eadb481fb0a09a865no14", "name": "gauss-9e1a_root_2", "availability_zone_id": "cn-southwest-244a", "description": "az1", "status": "normal" }, { "components": [ { "id": "cm_2", "role": "slave", "status": "Standby", "distributed_id": "", "type" : "CM", "detail" : "" }, { "id": "etcd_7002", "role": "slave", "status": "StateFollower", "distributed_id": "", "type" : "ETCD", "detail" : "" }, { "id": "dn_6002", "role": "slave", "status": "Standby", "distributed_id": "60011", "type" : "DN", "detail" : "Normal" } ], "id": "d6c6c6e6b48c41d79d99d7240751d744no14", "name": "gauss-9e1a_root_1", "availability_zone_id": "cn-southwest-244a", "description": "az1", "status": "normal" } ], "total_count": 3 }
  • URI GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/components 表1 参数说明 名称 参数类型 是否必选 说明 project_id String 是 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 instance_id String 是 实例ID。 limit Integer 否 查询记录数。默认为100,不能为负数,最小值为1,最大值为100。例如该参数设定为10,则查询结果最多只显示10条记录。 offset Integer 否 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。例如:该参数指定为0,limit指定为10,则只展示第1-10条数据。 component_type String 否 组件类型,过滤拿到需要的组件类型的组件信息,默认为ALL。传参数会查询对应组件信息, "ALL": 查询所有组件类型。 "CM": 查询CMS组件类型。枚举值: ALL CN DN CM GTM ETCD availability_zone_id String 否 主组件所在可用区编号,筛选符合条件的组件,默认为ALL,查询实例所有可用区上的节点的组件信息。 当调用接口传入可用区编号时: 相对于DN组件,会查询出的DN分片中的主组件在该可用区上的这个分片的所有副本的组件信息。 相对于CN组件,CN组件没有主备关系,会查询出该可用区上的CN组件信息。 相对于其他组件,会查询该可用区上有没有某个组件类型的主组件,有则会返回该组件类型的所有组件信息,没有则不返回该组件类型的信息。
  • 响应参数 表2 参数说明 名称 参数类型 说明 nodes Array of objects 组件详情。 详情请参见表3。 total_count Integer 总记录数。 表3 nodes说明 名称 参数类型 说明 id String 节点ID。 components Array of objects 该实例节点下的组件信息列表,详情请参见表4。 name String 节点名称。 availability_zone_id String 节点所在可用区编码。 description String 可用区描述信息。 status String 节点状态。 表4 components说明 名称 参数类型 说明 id String 组件ID。 GTM:Global Transaction Manager,全局事务管理器。用于管理事务状态的部件。 CMS:Cluster Management Server,集群管理组件。是用于管理集群状态的部件。 DN:Data Node,和CN对应的概念。负责实际执行表数据的存储、查询操作。 CN:Coordinator Node,负责数据库系统元数据存储、查询任务的分解和部分执行,以及将DN中查询结果汇聚在一起。 ETCD:Editable Text Configuration Daemon,分布式键值存储系统,用于共享配置和服务发现(服务注册和查找)。 role String 节点角色。 master:组件所在节点为主节点。 slave:组件所在节点为备节点。 status String 组件状态。 Primary:该组件为主。 Normal:该组件状态正常。 Down:该组件处于宕机状态。 Standby:该组件为备。 StateFollower:该ETCD为备。 StateLeader:该ETCD为主。 StateCandidate:该ETCD为仲裁。 distributed_id String 分组ID,只有DN组件有分组DN,用于区分是否是同一个分片下的组件。其他组件为空字符串。 type String 节点类型,包括:DN, CN, GTM, CM, ETCD。 detail String 详情。
  • 请求示例 修改实例的参数failed_login_attempts的值为4。不需要重启。 PUT https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in14/configurations { "values": { "failed_login_attempts": "4" } } 修改实例的参数track_activity_query_size的值为2048,修改参数max_replication_slots的值为25。需要重启。 PUT https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in14/configurations { "values": { "track_activity_query_size": "2048", "max_replication_slots": "25" } }
  • URI GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/db-upgrade/candidate-versions 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 instance_id 是 String 实例ID,严格匹配UUID规则。
  • 响应示例 实例在滚动升级中时,只返回滚动升级目标版本与滚动升级分片和AZ状态。 { "upgrade_type_list": [ { "upgrade_type": "grey", "upgrade_action_list": [ { "upgrade_action": "commit", "enable": false }, { "upgrade_action": "rollback", "enable": false }, { "upgrade_action": "upgrade", "enable": true }, { "upgrade_action": "upgradeAutoCommit", "enable": true } ], "enable": true, "is_parallel_upgrade": null }, { "upgrade_type": "hotfix", "upgrade_action_list": null, "enable": false, "is_parallel_upgrade": null }, { "upgrade_type": "inplace", "upgrade_action_list": [ { "upgrade_action": "upgradeAutoCommit", "enable": true } ], "enable": true, "is_parallel_upgrade": null } ], "rollback_enabled": false, "source_version": "8.102.0", "target_version": null, "roll_upgrade_progress": { "not_fully_upgraded_az": "cn-southwest-244a,cn-southwest-244b,cn-southwest-244c", "already_upgraded_az": "", "az_description_map": { "cn-southwest-244c": "az3", "cn-southwest-244b": "az2", "cn-southwest-244a": "az1" } }, "upgrade_candidate_versions": [ "8.300.0", "8.103.0" ], "hotfix_upgrade_candidate_versions": [], "hotfix_rollback_candidate_versions": [], "hotfix_upgrade_infos": [], "hotfix_rollback_infos": [] }
  • 响应示例 查询任务列表成功。 { "tasks" : [ { "instance_info" : { "instance_id" : "ce2dce50f365430abe161bab79495a6ein14", "instance_name" : "gauss-6568-zzh", "instance_status" : "creating" }, "job_id" : "03bc055a-135c-4245-8bd8-b0bc6d3350b3", "name" : "CreateGaussDBV5Instance", "status" : "Failed", "process" : null, "fail_reason" : "ECS云服务器处理异常。", "created_at": "2022-08-05T08:15:07+0800", "ended_at": "2022-08-09T03:06:52+0800" }, { "instance_info" : { "instance_id" : "20ba433bd7ee40da9cf35064f04f9e4cin14", "instance_name" : "gauss-7875-lt-m", "instance_status" : "deleted" }, "job_id" : "2cc16e0b-75ab-4a28-9453-16517e990bba", "name" : "DeleteGaussDBV5Instance", "status" : "Completed", "process" : null, "fail_reason" : null, "created_at": "2022-08-06T09:15:07+0800", "ended_at": "2022-08-10T03:06:52+0800" } ], "total_count" : 2 }
  • 请求示例 查询任务状态为“运行中”的任务列表 GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Running&name=CreateGaussDBV5Instance&offset=1&limit=10 查询任务状态为“完成”的任务列表 GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Completed&name=CreateGaussDBV5Instance&offset=1&limit=10 查询任务状态为“失败”的任务列表 GET https://gaussdb-opengauss.cn-north-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/tasks?status=Failed&name=CreateGaussDBV5Instance&offset=1&limit=10
  • URI GET https://{Endpoint}/v3/{project_id}/tasks 表1 参数说明 名称 是否必选 参数类型 说明 project_id 是 String 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 status 否 String 任务状态。 Running:运行中 Completed:完成 Failed:失败 name 否 String 任务名称。 CreateGaussDBV5Instance:创建实例。 BackupSnapshotGaussDBV5InInstance:手动创建备份。 CloneGaussDBV5NewInstance:恢复到新实例。 RestoreGaussDBV5InInstance:恢复到当前实例。 RestoreGaussDBV5InInstanceToExistedInst:恢复到已有实例 DeleteGaussDBV5Instance:删除实例。 EnlargeGaussDBV5Volume:磁盘扩容。 ResizeGaussDBV5Flavor:规格变更。 GaussDBV5ExpandClusterCN:协调节点扩容。 GaussDBV5ExpandClusterDN:分片扩容。 start_time 否 String 开始时间。UNIX时间戳格式,单位是毫秒,时区是UTC。 end_time 否 String 结束时间。UNIX时间戳格式,单位是毫秒,时区是UTC。 offset 否 Integer 索引位置,偏移量。从第一条数据偏移offset条数据后开始查询,默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数。 limit 否 Integer 查询记录数。默认为100,不能为负数,最小值为1,最大值为100
  • 响应参数 表2 要素说明 名称 参数类型 说明 tasks Array of objects 任务列表。 详情请参见表3 tasks字段数据结构说明。 total_count Integer 任务数量。 表3 tasks字段数据结构说明 名称 参数类型 说明 instance_info Object 任务绑定的实例信息。 详情请参见表4 instance_info字段数据结构说明。 job_id String 任务ID。 name String 任务名称。 status String 任务状态。 process String 任务进度,单位:%。 fail_reason String 失败原因。 created_at String 创建时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。 ended_at String 结束时间,格式为“yyyy-mm-ddThh:mm:ssZ”。 其中,T指某个时间的开始;Z指时区偏移量,例如北京时间偏移显示为+0800。 表4 instance_info字段数据结构说明 名称 参数类型 说明 instance_id String 实例ID。 instance_name String 实例名称。 instance_status String 实例状态。
  • 响应示例 查询磁盘自动扩容策略成功。 { "switch_option" : true, "limit_volume_size" : 200, "min_volume_size" : 160, "max_volume_size" : 240, "trigger_available_percent" : 20, "percents": [ 20, 25, 50 ], "step_size": 200, "step_percent": null }
  • URI GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/auto-enlarge-policy 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 租户在某一Region下的项目ID。 获取方法请参见获取项目ID。 instance_id 是 String 实例ID,严格匹配UUID规则。