更新时间:2024-09-12 GMT+08:00
分享

查询HTAP实例列表

功能介绍

查询HTAP实例列表。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/instances/{instance_id}/htap

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的project ID。

获取方法请参见获取项目ID

instance_id

String

GaussDBForMySQL实例ID,严格匹配UUID规则。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取。

请求响应成功后在响应消息头中包含的“X-Subject-Token”的值即为Token值。

Content-Type

String

内容类型。 取值:application/json。

X-Language

String

请求语言类型。默认en-us。

取值范围:

  • en-us

  • zh-cn

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

total

Integer

HTAP实例个数。

instances

Array of instances objects

HTAP实例信息。

max_htap_instance_num_of_taurus

Integer

最大HTAP实例个数。

表4 instances

参数

参数类型

描述

id

String

HTAP实例ID,严格匹配UUID规则。

name

String

HTAP实例名。

engine_name

String

HTAP数据库引擎名。

engine_version

String

HTAP数据库引擎版本。

project_id

String

租户在某一region下的project ID

instance_state

instance_state object

HTAP实例状态信息。

create_at

Long

HTAP实例创建时间。

is_frozen

Boolean

HTAP实例是否冻结。

ha_mode

String

HTAP实例部署模式。

pay_model

String

计费模式。当前仅支持按需计费。

0:按需计费

1:包周期

order_id

String

包周期计费订单ID。

alter_order_id

String

包周期计费备用订单ID。

data_vip

String

读写内网地址。

readable_node_infos

Array of ReadableNodeInfos objects

可读节点信息

proxy_ips

Array of strings

代理IP。

data_vip_v6

String

读写内网地址IPV6。

port

Integer

数据库访问端口。

available_zones

Array of available_zones objects

可用区信息。

current_actions

Array of QueryAction objects

实例动作。

volume_type

String

存储类型。

server_type

String

服务器类型。

enterprise_project_id

String

企业项目ID。如果账户开通企业项目服务则该参数必选,未开启该参数不可选。

dedicated_resource_id

String

专属资源池ID,只有开通专属资源池后才支持此参数。

network

network object

网络信息。

ch_master_node_id

String

ClickHouse主节点ID。

node_num

Integer

节点个数。

表5 instance_state

参数

参数类型

描述

instance_status

String

HTAP实例状态。

create_fail_error_code

String

HTAP实例创建失败错误码。

fail_message

String

HTAP实例创建失败错误信息。

wait_restart_for_params

Boolean

是否需要重启更新参数。

表6 ReadableNodeInfos

参数

参数类型

描述

data_ip

String

可读节点IP。

node_id

String

可读节点ID。

node_name

String

可读节点名称。

表7 available_zones

参数

参数类型

描述

code

String

可用区码。

description

String

可用区描述。

az_type

String

可用区类型。

表8 QueryAction

参数

参数类型

描述

id

String

实例或节点动作ID。

action

String

实例或节点动作名称。

object_id

String

实例或节点动作对象ID。

type

String

实例或节点动作类型。

job_id

String

实例或节点动作任务ID。

status

String

实例或节点动作状态。

created_at

Long

实例或节点动作创建时间。

updated_at

Long

实例或节点动作更新时间。

表9 network

参数

参数类型

描述

vpc_id

String

虚拟私有云ID。

sub_net_id

String

子网ID。

security_group_id

String

安全组ID。

状态码: 400

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

状态码: 500

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

请求示例

查询GaussDBforMySQL下HTAP实例列表

GET https://{endpoint}/v3/23a50154cf494ec9ad6883979a12db0a/instances/18c3eeb7b788479eb8b93b209946a83bin07/htap

响应示例

状态码: 200

Success.

{
  "total" : 2,
  "instances" : [ {
    "id" : "5fbd54b94f0f4adbb17f728f581d247ein17",
    "name" : "htap-1f05",
    "engine_name" : "star-rocks",
    "engine_version" : "3.1.11",
    "project_id" : "23a50154cf494ec9ad6883979a12db0a",
    "instance_state" : {
      "instance_status" : "normal",
      "create_fail_error_code" : null,
      "fail_message" : null,
      "wait_restart_for_params" : false
    },
    "create_at" : 1716364704475,
    "is_frozen" : false,
    "ha_mode" : "Cluster",
    "pay_model" : "0",
    "order_id" : null,
    "alter_order_id" : "",
    "data_vip" : "192.168.8.69,192.168.8.28,192.168.8.91",
    "readable_node_infos" : [ {
      "data_ip" : "192.168.8.69",
      "node_id" : "48e89b523de54a168bdd5ce0d6c134f0no17",
      "node_name" : "htap-1f05_fe_shard01_node01"
    }, {
      "data_ip" : "192.168.8.28",
      "node_id" : "70bcbaef85164a299188cc6798de67f6no17",
      "node_name" : "htap-1f05_fe_shard01_node02"
    }, {
      "data_ip" : "192.168.8.91",
      "node_id" : "f50fdf0c1e7447b3bca7d9eefe9d4a30no17",
      "node_name" : "htap-1f05_fe_shard01_node03"
    } ],
    "proxy_ips" : [ ],
    "data_vip_v6" : null,
    "port" : 3306,
    "available_zones" : [ {
      "code" : "cn-southwest-244d",
      "description" : "az4",
      "az_type" : "Center"
    } ],
    "current_actions" : [ ],
    "volume_type" : "SSD",
    "server_type" : "KVM",
    "enterprise_project_id" : "0",
    "dedicated_resource_id" : "",
    "network" : {
      "vpc_id" : "f7876b94-3696-419b-a609-161de4b42d59",
      "sub_net_id" : "09249318-4a97-4e48-b314-ffaab86d4295",
      "security_group_id" : ""
    },
    "ch_master_node_id" : null,
    "node_num" : 6
  }, {
    "id" : "914481def3574d5189baee926a26512din17",
    "name" : "htap-5d98",
    "engine_name" : "star-rocks",
    "engine_version" : "3.1.11",
    "project_id" : "23a50154cf494ec9ad6883979a12db0a",
    "instance_state" : {
      "instance_status" : "normal",
      "create_fail_error_code" : "500000",
      "fail_message" : null,
      "wait_restart_for_params" : false
    },
    "create_at" : 1716344516418,
    "is_frozen" : false,
    "ha_mode" : "Single",
    "pay_model" : "0",
    "order_id" : null,
    "alter_order_id" : "",
    "data_vip" : "192.168.8.4",
    "readable_node_infos" : [ {
      "data_ip" : "192.168.8.4",
      "node_id" : "7739bfbc4e244a8bac0662d63683c808no17",
      "node_name" : "htap-5d98_fe_shard01_node01"
    } ],
    "proxy_ips" : [ ],
    "data_vip_v6" : null,
    "port" : 3306,
    "available_zones" : [ {
      "code" : "cn-southwest-244d",
      "description" : "az4",
      "az_type" : "Center"
    } ],
    "current_actions" : [ ],
    "volume_type" : "SSD",
    "server_type" : "KVM",
    "enterprise_project_id" : "0",
    "dedicated_resource_id" : "",
    "network" : {
      "vpc_id" : "f7876b94-3696-419b-a609-161de4b42d59",
      "sub_net_id" : "09249318-4a97-4e48-b314-ffaab86d4295",
      "security_group_id" : ""
    },
    "ch_master_node_id" : null,
    "node_num" : 2
  } ],
  "max_htap_instance_num_of_taurus" : 10
}

SDK代码示例

SDK代码示例如下。

 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
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.gaussdb.v3.region.GaussDBRegion;
import com.huaweicloud.sdk.gaussdb.v3.*;
import com.huaweicloud.sdk.gaussdb.v3.model.*;


public class ListHtapInstanceInfoSolution {

    public static void main(String[] args) {
        // 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
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        GaussDBClient client = GaussDBClient.newBuilder()
                .withCredential(auth)
                .withRegion(GaussDBRegion.valueOf("<YOUR REGION>"))
                .build();
        ListHtapInstanceInfoRequest request = new ListHtapInstanceInfoRequest();
        request.withInstanceId("{instance_id}");
        try {
            ListHtapInstanceInfoResponse response = client.listHtapInstanceInfo(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkgaussdb.v3.region.gaussdb_region import GaussDBRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkgaussdb.v3 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.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = GaussDBClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(GaussDBRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListHtapInstanceInfoRequest()
        request.instance_id = "{instance_id}"
        response = client.list_htap_instance_info(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    gaussdb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/gaussdb/v3/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")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := gaussdb.NewGaussDBClient(
        gaussdb.GaussDBClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListHtapInstanceInfoRequest{}
	request.InstanceId = "{instance_id}"
	response, err := client.ListHtapInstanceInfo(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Success.

400

Client error.

500

Server error.

错误码

请参见错误码

相关文档