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

查询StarRocks实例

功能介绍

查询StarRocks实例。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/instances/{instance_id}/starrocks/{starrocks_instance_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的project ID。

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

instance_id

String

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

starrocks_instance_id

String

StarRocks实例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参数

参数

参数类型

描述

instances

Array of instances objects

实例信息。

表4 instances

参数

参数类型

描述

id

String

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

name

String

创建的实例名称。

project_id

String

租户在某一Region下的project ID。

public_ip

String

公网访问IP。

data_vip

String

StarRocks FE节点类型数据IP(多个IP使用逗号分隔)

can_enable_public_access

Boolean

是否可公网访问。

current_backup_node_id

String

备份节点ID。

cluster_mode

String

部署模式。

status

String

实例状态。

is_frozen

Integer

是否冻结。

frozen_time

Long

冻结时间。

db_user

String

默认用户名。

bak_period

String

备份周期。

bak_keep_day

Integer

备份保存天数。

bak_expected_start_time

Long

备份预计开始时间。

data_store_version_id

String

数据库版本ID。

data_store_version

String

数据库版本。

data_store_type

String

数据库引擎。

create_at

Long

实例创建时间。

update_at

Long

实例更新时间。

delete_at

Long

实例删除时间。

db_port

String

数据库端口号。

param_group

String

参数组。

actions

Array of QueryAction 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:单可用区

  • multi:多可用区

enterprise_project_id

String

企业项目ID。

port_info

port_info object

端口信息。

fe_node_volume_code

String

FE节点磁盘类型。

be_node_volume_code

String

BE节点磁盘类型。

fe_node_volume_size

String

FE节点磁盘大小。

be_node_volume_size

String

BE节点磁盘大小。

support_data_replication

Boolean

是否支持数据同步。

new_version_available

Boolean

是否有数据库新版本。

ssl_option

Boolean

SSL开关。

dedicated_resource_id

String

专属资源池ID,只有数据库实例属于专属资源池才会返回该参数。

pay_model

String

支付模式。

表5 groups

参数

参数类型

描述

id

String

分组ID。

name

String

分组名。

nodes

Array of nodes objects

实例节点。

group_type_name

String

实例分组类型名。

group_node_type

String

实例分组节点类型。

表6 nodes

参数

参数类型

描述

id

String

实例节点ID。

name

String

实例节点名。

type

String

实例节点类型。

status

String

节点状态。

取值:

值为“creating”,表示节点正在创建。

值为“normal”,表示节点正常。

值为“abnormal”,表示节点异常。

值为“createfail”,表示节点创建失败。

period

String

实例节点包周期。1代表包周期。

volume

volume object

实例节点存储信息。

cpu

String

实例节点cpu数量。

mem

String

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

datastore

datastore object

数据库信息。

actions

Array of QueryAction objects

节点动作。

priority

Integer

节点优先级。

frozen_flag

Integer

冻结标志。

db_port

Integer

数据库端口号。默认3306。

pay_model

String

支付模式。

order_id

String

订单号。

traffic_ip

String

数据IP。

traffic_ipv6

String

数据IPV6。

az_code

String

可用区代码。

az_description

String

可用区描述。

az_type

String

可用区类型。

region_code

String

实例所在区域。

create_at

Long

节点创建时间。

update_at

Long

节点更新时间。

flavor_id

String

节点规格ID。

flavor_ref

String

节点规格码。

iass_flavor_ref

String

IASS规格码。

max_connections

String

公网最大连接数。

vpc_id

String

虚拟私有云ID。

subnet_id

String

子网ID。

need_restart

Boolean

参数更新是否需要重启。

sg_id

String

安全组。

param_group

Map<String,ParamGroup>

参数组信息。

表7 volume

参数

参数类型

描述

type

String

实例节点存储类型。

size

String

实例节点存储大小。

表8 datastore

参数

参数类型

描述

id

String

数据库ID。

type

String

数据库类型。

version

String

数据库版本。

表9 QueryAction

参数

参数类型

描述

id

String

实例或节点动作ID。

action

String

实例或节点动作名称。

object_id

String

实例或节点动作对象ID。

type

String

实例或节点动作类型。

job_id

String

实例或节点动作任务ID。

status

String

实例或节点动作状态。

枚举值:

  • OK_TO_RUN

  • DELETED

created_at

Long

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

updated_at

Long

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

表10 ParamGroup

参数

参数类型

描述

id

String

参数组ID。

name

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

标签键。最大长度36个unicode字符。key不能为空或者空字符串,不能为空格。

字符集:A-Z,a-z ,0-9,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

value

String

标签值。最大长度43个unicode字符。可以为空字符串。

字符集:A-Z,a-z ,0-9,‘.’,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

表14 sys_tags

参数

参数类型

描述

key

String

标签键。最大长度36个unicode字符。key不能为空或者空字符串,不能为空格。

字符集:A-Z,a-z ,0-9,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

value

String

标签值。最大长度43个unicode字符。可以为空字符串。

字符集:A-Z,a-z ,0-9,‘.’,‘-’,‘_’,UNICODE字符(\u4E00-\u9FFF)。

表15 port_info

参数

参数类型

描述

mysql_port

Integer

MySQL端口号。默认3306。

状态码: 400

表16 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

状态码: 500

表17 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误消息。

请求示例

查询某个StarRocks实例ID。

GET https://{endpoint}/v3/23a50154cf494ec9ad6883979a12db0a/instances/fb632d1d531a4107804f0f082581810fin07/starrocks/b6280c323ce449f2ad02af74e21f3dc5in17

响应示例

状态码: 200

Success.

{
  "instances" : [ {
    "id" : "914481def3574d5189baee926a26512din17",
    "name" : "htap-5d98",
    "project_id" : "23a50154cf494ec9ad6883979a12db0a",
    "public_ip" : "",
    "data_vip" : "192.168.8.4",
    "can_enable_public_access" : false,
    "current_backup_node_id" : null,
    "cluster_mode" : "Single",
    "status" : "normal",
    "is_frozen" : 0,
    "frozen_time" : null,
    "db_user" : "root",
    "bak_period" : null,
    "bak_keep_day" : null,
    "bak_expected_start_time" : null,
    "data_store_version_id" : "717b683b-9d89-3e3b-9100-7893bee47d95",
    "data_store_version" : "3.1.11.0",
    "data_store_type" : "star-rocks",
    "create_at" : 1716344516418,
    "update_at" : 1716347522157,
    "delete_at" : null,
    "db_port" : "3306",
    "param_group" : null,
    "actions" : [ ],
    "create_fail_error_code" : "500000",
    "groups" : [ {
      "id" : "8d9d63263ece41619ba819f8d85c5cafgr17",
      "name" : "htap-5d98_fe_shard01",
      "nodes" : [ {
        "id" : "7739bfbc4e244a8bac0662d63683c808no17",
        "name" : "htap-5d98_fe_shard01_node01",
        "type" : "fe-leader",
        "status" : "normal",
        "period" : "null",
        "volume" : {
          "type" : "SSD",
          "size" : "50000000000"
        },
        "cpu" : "4",
        "mem" : "16",
        "datastore" : {
          "id" : "717b683b-9d89-3e3b-9100-7893bee47d95",
          "type" : "star-rocks",
          "version" : "3.1.11.0"
        },
        "actions" : [ ],
        "priority" : 1,
        "frozen_flag" : 0,
        "db_port" : 3306,
        "pay_model" : "0",
        "order_id" : null,
        "traffic_ip" : "192.168.8.4",
        "traffic_ipv6" : "",
        "az_code" : "cn-southwest-244d",
        "az_description" : "az4",
        "az_type" : "Center",
        "region_code" : "cn-southwest-244",
        "create_at" : 1716344516418,
        "update_at" : 1716361751849,
        "flavor_id" : "afef3bfd-ac7c-32e1-ba44-c388acbb196a",
        "flavor_ref" : "gaussdb.sr-fe.xlarge.x86.4",
        "iass_flavor_ref" : "c6.xlarge.4",
        "max_connections" : "0",
        "vpc_id" : "f7876b94-3696-419b-a609-161de4b42d59",
        "subnet_id" : "09249318-4a97-4e48-b314-ffaab86d4295",
        "need_restart" : false,
        "sg_id" : "",
        "param_group" : null
      } ],
      "group_type_name" : "starrocks",
      "group_node_type" : "fe"
    }, {
      "id" : "fc416acdc4c1439e85100e9a7c161932gr17",
      "name" : "htap-5d98_be_shard01",
      "nodes" : [ {
        "id" : "ccab0ba176e642c69d598f2f3c0f06efno17",
        "name" : "htap-5d98_be_shard01_node01",
        "type" : "be",
        "status" : "normal",
        "period" : "null",
        "volume" : {
          "type" : "SSD",
          "size" : "50000000000"
        },
        "cpu" : "4",
        "mem" : "16",
        "datastore" : {
          "id" : "717b683b-9d89-3e3b-9100-7893bee47d95",
          "type" : "star-rocks",
          "version" : "3.1.11.0"
        },
        "actions" : [ ],
        "priority" : 1,
        "frozen_flag" : 0,
        "db_port" : 3306,
        "pay_model" : "0",
        "order_id" : null,
        "traffic_ip" : "192.168.8.194",
        "traffic_ipv6" : "",
        "az_code" : "cn-southwest-244d",
        "az_description" : "az4",
        "az_type" : "Center",
        "region_code" : "cn-southwest-244",
        "create_at" : 1716344516418,
        "update_at" : 1716358866767,
        "flavor_id" : "de565db8-0a96-37ea-9388-61167624712c",
        "flavor_ref" : "gaussdb.sr-be.xlarge.x86.4",
        "iass_flavor_ref" : "c6.xlarge.4",
        "max_connections" : "0",
        "vpc_id" : "f7876b94-3696-419b-a609-161de4b42d59",
        "subnet_id" : "09249318-4a97-4e48-b314-ffaab86d4295",
        "need_restart" : false,
        "sg_id" : "",
        "param_group" : null
      } ],
      "group_type_name" : "starrocks",
      "group_node_type" : "be"
    } ],
    "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",
    "enterprise_project_id" : "0",
    "port_info" : {
      "mysql_port" : 3306
    },
    "fe_node_volume_code" : "gaussdb.sr.evs.ultrahighio",
    "be_node_volume_code" : "gaussdb.sr.evs.ultrahighio",
    "fe_node_volume_size" : "50000000000",
    "be_node_volume_size" : "50000000000",
    "support_data_replication" : true,
    "new_version_available" : false,
    "ssl_option" : false,
    "dedicated_resource_id" : null,
    "pay_model" : "0"
  } ]
}

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

    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();
        ListStarrocksInstanceInfoRequest request = new ListStarrocksInstanceInfoRequest();
        try {
            ListStarrocksInstanceInfoResponse response = client.listStarrocksInstanceInfo(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 = ListStarrocksInstanceInfoRequest()
        response = client.list_starrocks_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
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.ListStarrocksInstanceInfoRequest{}
	response, err := client.ListStarrocksInstanceInfo(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.

错误码

请参见错误码

分享:

    相关文档

    相关产品