更新时间:2025-07-24 GMT+08:00
分享

查询HTAP实例列表

功能介绍

查询HTAP实例列表。

调用方法

请参见如何调用API

URI

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

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释

租户在某一Region下的project ID。

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

约束限制

不涉及。

取值范围

只能由英文字母、数字组成,且长度为32个字符。

默认取值

不涉及。

instance_id

String

参数解释

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

约束限制

不涉及。

取值范围

只能由英文字母、数字组成,后缀为in07,长度为36个字符。

默认取值

不涉及。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释

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

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

约束限制

不涉及。

取值范围

不涉及。

默认取值

不涉及。

Content-Type

String

参数解释

内容类型。

约束限制

不涉及。

取值范围

application/json。

默认取值

application/json。

X-Language

String

参数解释

请求语言类型。

约束限制

不涉及。

取值范围

  • en-us

  • zh-cn

默认取值

en-us。

响应参数

状态码: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

参数解释

错误消息。

取值范围

不涉及。

请求示例

查询TaurusDB下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.

错误码

请参见错误码

相关文档