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

查询实例详情

功能介绍

查询实例详情。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/instances/{instance_id}/clickhouse/{clickhouse_instance_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的project ID。

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

instance_id

String

GaussDB(for MySQL)实例ID,严格匹配UUID规则。

clickhouse_instance_id

String

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

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

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

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

X-Language

String

请求语言类型。默认en-us。 取值范围:

  • en-us

  • zh-cn

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

instance

instance object

实例信息。

表4 instance

参数

参数类型

描述

id

String

实例ID。

name

String

实例名称。

project_id

String

租户在某一Region下的project ID。

public_ip

String

公网访问IP。

can_enable_public_access

Boolean

是否可公网访问。

current_backup_node_id

String

备份节点ID。

cluster_mode

String

部署模式。 取值范围:

  • Single:单机

  • Ha:主备

status

String

实例状态。

is_frozen

Integer

是否冻结。 取值范围:

  • 0:不冻结

  • 1:冻结

frozen_time

String

冻结时间。

db_user

String

默认用户。

bak_period

String

备份周期。

bak_keep_day

Integer

备份保存天数。

bak_expected_start_time

String

备份预计开始时间。

datastore_version_id

String

数据库版本ID。

datastore_version

String

数据库版本。

datastore_type

String

数据库引擎。

create_at

String

实例创建时间。

update_at

String

实例更新时间。

delete_at

String

实例删除时间。

db_port

Integer

数据库端口号。取值范围0~65535。

param_group

param_group object

参数组。

actions

Array of ChQueryActionInfo objects

实例动作。

create_fail_error_code

String

实例创建失败错误码。

groups

Array of groups objects

实例分组。

ops_window

ops_window object

实例操作时间窗。

tags_info

tags_info object

实例标签。

time_zone

String

时区。

backup_used_space

String

备份使用空间。

az_mode

String

可用区模式。 取值范围:

  • single:单可用区

  • double:多可用区-

master_az_code

String

主可用区。

enterprise_project_id

String

企业项目ID。

port_info

port_info object

端口信息。

volume_code

String

磁盘规格码。

support_data_replication

Boolean

是否支持副本。

new_version_available

Boolean

是否有数据库新版本。

ssl_option

Boolean

SSL开关。

dedicated_resource_id

String

专属资源池ID。

pay_model

String

支付模式。 取值范围:

  • 0:按需计费

  • 1:包周期-

表5 param_group

参数

参数类型

描述

id

String

参数ID。

name

String

参数名。

表6 ChQueryActionInfo

参数

参数类型

描述

id

String

实例动作ID。

action

String

实例动作名称。

object_id

String

实例动作对象ID。

type

String

实例动作类型。

job_id

String

实例动作任务ID。

status

String

实例动作状态。

created_at

String

实例动作创建时间。

updated_at

String

实例动作更新时间。

表7 groups

参数

参数类型

描述

id

String

分组ID。

name

String

分组名。

group_type_name

String

实例分组类型名,现在只支持clickhouse。

nodes

Array of ClickHouseNodeInfo objects

实例节点信息。

表8 ClickHouseNodeInfo

参数

参数类型

描述

id

String

实例节点ID。

name

String

实例节点名。

type

String

实例节点类型。 取值范围:

  • master:主节点

  • slave:备节点

status

String

实例节点状态。

period

String

实例节点周期。

volume

volume object

实例节点存储信息。

cpu

String

实例节点cpu数量。

mem

String

实例节点内存大小(GB)。

datastore

datastore object

数据存储信息。

priority

Integer

节点优先级。

frozen_flag

Integer

冻结标志。 取值范围:

  • 0:不冻结

  • 1:冻结

db_port

Integer

数据库端口号。取值范围:0~65535。

pay_model

String

支付模式。 取值范围:

  • 0:按需计费

  • 1:包周期

order_id

String

包周期订单ID。

traffic_ip

String

节点数据ip。

traffic_ipv6

String

节点数据ipv6。

traffic_vip

String

节点数据vip。

traffic_vipv6

String

节点数据vipV6。

az_code

String

可用区。

az_description

String

可用区描述。

az_type

String

可用区类型。

region

String

节点所在区。

create_at

String

节点创建时间。

update_at

String

节点更新时间。

flavor_id

String

节点规格ID。

flavor_ref

String

节点规格码。

iass_flavor_ref

String

IASS规格码。

max_connections

Integer

公网最大连接数。

vpc_id

String

虚拟私有云ID。

subnet_id

String

子网ID。

need_restart

Boolean

参数更新是否需要重启。

sg_id

String

安全组

表9 volume

参数

参数类型

描述

type

String

实例节点存储类型。 取值范围:

  • SSD:超高IO

  • ESSD:极速型SSD

size

String

实例节点存储大小。

used

String

实例节点存储使用大小。

iops

Integer

实例节点存储IOPS大小。

表10 datastore

参数

参数类型

描述

id

String

引擎ID。

type

String

引擎类型,现在只支持click-house。

version

String

引擎版本。

表11 ops_window

参数

参数类型

描述

period

String

时间窗周期。

start_time

String

时间窗开始时间。

end_time

String

时间窗结束时间。

表12 tags_info

参数

参数类型

描述

tags

Array of tags objects

用户标签。

sys_tags

Array of sys_tags objects

系统标签。

表13 tags

参数

参数类型

描述

key

String

标签键。

value

String

标签值。

表14 sys_tags

参数

参数类型

描述

key

String

标签键。

value

String

标签值。

表15 port_info

参数

参数类型

描述

tep_port

Integer

tep端口。取值范围:0~65535。

http_port

Integer

http端口。取值范围:0~65535。

mysql_port

Integer

MySql端口号。取值范围:0~65535。

https_port

Integer

https端口号。取值范围:0~65535。

tep_secure_port

Integer

tep安全端口。取值范围:0~65535。

状态码: 400

表16 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 500

表17 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

查询ClickHouse实例详情。

GET https://{endpoint}/v3/23a50154cf494ec9ad6883979a12db0a/instances/fb632d1d531a4107804f0f082581810fin07/clickhouse/df3ae779e2ad4993a03ccd7a81240125in16

响应示例

状态码: 200

Success.

{
  "instance" : {
    "id" : "f8d286fa7db44f51aed30ed7eb6da007in16",
    "name" : "htap-1fb3",
    "project_id" : "23a50154cf494ec9ad6883979a12db0a",
    "public_ip" : "",
    "can_enable_public_access" : false,
    "current_backup_node_id" : null,
    "cluster_mode" : "Single",
    "status" : "normal",
    "is_frozen" : 0,
    "frozen_time" : null,
    "db_user" : null,
    "bak_period" : null,
    "bak_keep_day" : null,
    "bak_expected_start_time" : null,
    "datastore_version_id" : "6a9e233f-e7da-3e81-b12f-7a41a8689250",
    "datastore_version" : "1.23.3.24",
    "datastore_type" : "click-house",
    "create_at" : 1714099209183,
    "update_at" : 1714099209781,
    "delete_at" : null,
    "db_port" : "3306",
    "param_group" : {
      "id" : "1661d4eddd4444dd8447992e74fa3b3epr16",
      "name" : "Default-clickhouse"
    },
    "actions" : [ ],
    "create_fail_error_code" : "",
    "groups" : [ {
      "id" : "f3f95d4a837f42ee921760f3c7a0e730gr16",
      "name" : "htap-1fb3_shard01",
      "group_type_name" : "clickhouse",
      "nodes" : [ {
        "id" : "8f23427bf3764627bca1ee40e2364abfno16",
        "name" : "htap-1fb3_shard01_node01",
        "type" : "master",
        "status" : "normal",
        "period" : "null",
        "volume" : {
          "type" : "SSD",
          "size" : "50000000000"
        },
        "cpu" : "4",
        "mem" : "16",
        "datastore" : {
          "id" : "6a9e233f-e7da-3e81-b12f-7a41a8689250",
          "type" : "click-house",
          "version" : "1.23.3.24"
        },
        "priority" : 1,
        "frozen_flag" : 0,
        "db_port" : 3306,
        "pay_model" : "0",
        "order_id" : "",
        "traffic_ip" : "192.168.0.55",
        "traffic_ipv6" : "",
        "traffic_vip" : "",
        "traffic_vipv6" : "",
        "az_code" : "cn-southwest-244b",
        "az_description" : "可用区2",
        "az_type" : "Center",
        "region" : "cn-southwest-244",
        "create_at" : 1714099209183,
        "update_at" : 1714099209183,
        "flavor_id" : "b44cfde6-d250-313c-8d7a-cd216f071658",
        "flavor_ref" : "gaussdb.ch.xlarge.x86.4",
        "iass_flavor_ref" : "c3.xlarge.4",
        "max_connections" : "0",
        "vpc_id" : "134c4042-1a1f-4cb8-8258-219a2f6c0d4d",
        "subnet_id" : "072e022f-13aa-4c8f-8d64-492cfd123305",
        "need_restart" : false,
        "sg_id" : ""
      } ]
    } ],
    "ops_window" : {
      "period" : null,
      "start_time" : "18:00",
      "end_time" : "22:00"
    },
    "tags_info" : {
      "tags" : [ ],
      "sys_tags" : [ {
        "key" : "_sys_enterprise_project_id",
        "value" : "0"
      } ]
    },
    "time_zone" : "UTC+08:00",
    "backup_used_space" : null,
    "az_mode" : "single",
    "master_az_code" : null,
    "enterprise_project_id" : null,
    "port_info" : {
      "tep_port" : 9000,
      "http_port" : 8123,
      "mysql_port" : 3306,
      "https_port" : 8443,
      "tep_secure_port" : 9440
    },
    "volume_code" : "gaussdb.ch.evs.ultrahighio",
    "support_data_replication" : true,
    "new_version_available" : false,
    "ssl_option" : true,
    "dedicated_resource_id" : null,
    "pay_model" : null
  }
}

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
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 ListClickHouseInstanceSolution {

    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");

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

        GaussDBClient client = GaussDBClient.newBuilder()
                .withCredential(auth)
                .withRegion(GaussDBRegion.valueOf("<YOUR REGION>"))
                .build();
        ListClickHouseInstanceRequest request = new ListClickHouseInstanceRequest();
        try {
            ListClickHouseInstanceResponse response = client.listClickHouseInstance(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
# 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"]

    credentials = BasicCredentials(ak, sk)

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

    try:
        request = ListClickHouseInstanceRequest()
        response = client.list_click_house_instance(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
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")

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

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

    request := &model.ListClickHouseInstanceRequest{}
	response, err := client.ListClickHouseInstance(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.

错误码

请参见错误码

相关文档