获取集群ID
在调用接口的时候,部分URL中需要填入集群ID(cluster_id),所以需要获取到集群ID。获取方法如下所示:
调用API获取集群ID
集群ID可以通过调用查询集群列表API接口获取。
获取集群ID的接口为“GET https://{Endpoint}/v1.0/{project_id}/clusters”,其中{Endpoint}为IAM的终端节点,可以从地区和终端节点获取;项目ID参见获取项目ID;接口的认证鉴权请参见认证鉴权。
响应示例如下,在该项目找到指定clusters下的“id”即为集群ID。
{ "clusters" : [ { "id" : "7d85f602-a948-4a30-afd4-e84f47471c15", "name" : "dws-1", "status" : "AVAILABLE", "version" : "1.2.0", "updated" : "2016-02-10T14:28:14Z", "created" : "2016-02-10T14:26:14Z", "port" : 8000, "endpoints" : [ { "connect_info" : "dws-1.cn-north-4.myhuaweicloud.com", "jdbc_url" : "jdbc:postgresql://dws-1.cn-north-4.myhuaweicloud.com/<YOUR_DATABASE_name>" } ], "nodes" : [ { "id" : "acaf62a4-41b3-4106-bf6b-2f669d88291e", "status" : "200" }, { "id" : "d32de51e-4fcd-4e5a-a9dc-bb903abb494b", "status" : "200" }, { "id" : "d71a4a25-c9bc-4ffd-9f4a-e422aef327f9", "status" : "200" } ], "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value2" } ], "user_name" : "dbadmin", "number_of_node" : 3, "recent_event" : 6, "availability_zone" : "cn-north-4b", "enterprise_project_id" : "0", "node_type" : "dws.d1.xlarge.ultrahigh", "vpc_id" : "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574", "subnet_id" : "374eca02-cfc4-4de7-8ab5-dbebf7d9a720", "public_ip" : { "public_bind_type" : "auto_assign", "eip_id" : "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574" }, "public_endpoints" : [ { "public_connect_info" : "dws-1.cn-north-4.myhuaweicloud.com", "jdbc_url" : "jdbc:postgresql://dws-1.cn-north-4.myhuaweicloud.com/<YOUR_DATABASE_name>" } ], "action_progress" : { "SNAPSHOTTING" : "20%" }, "sub_status" : "READONLY", "task_status" : "SNAPSHOTTING", "security_group_id" : "dc3ec145-9029-4b39-b5a3-ace5a01f772b" } ] }
从控制台获取集群ID
- 登录GaussDB(DWS)管理控制台。
- 在左侧导航栏,单击“集群管理”。
- 在集群列表中找到所需要的集群,然后单击集群名称,进入集群“集群详情”页面。
- 在“基本信息”模块查看集群ID,如下图所示。
图1 查看集群ID