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

查询重分布详情

功能介绍

该接口用于查看当前集群的重分布模式、重分布进度、数据表重分布详情等监控信息。 查看重分布详情功能仅DWS 2.0和8.1.1.200及以上集群版本支持,其中数据表重分布进度详情仅DWS 2.0和8.2.1及以上集群版本支持。

调用方法

请参见如何调用API

URI

GET /v2/{project_id}/clusters/{cluster_id}/redistribution
表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

cluster_id

String

集群ID。获取方法,请参见获取集群ID

表2 Query参数

参数

是否必选

参数类型

描述

limit

Integer

分页查询,每页大小。

offset

Integer

分页查询,偏移。

db_name

String

数据库名称。

table_name

String

表名称。

type

String

类型。

请求参数

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

redis_info

RdsRedisInfo object

重分布信息。

schedule_mode

Boolean

调度模式。

pause_enable

Boolean

是否允许暂停。

recover_enable

Boolean

是否允许恢复。

retry_enable

Boolean

是否允许重试。

update_enable

Boolean

是否允许更新。

control_enable

Boolean

是否允许控制。

表4 RdsRedisInfo

参数

参数类型

描述

id

String

ID。

cluster_id

String

集群ID。

start_time

String

开始时间。

end_time

String

结束时间。

status

String

状态。

redis_conf

RedisConf object

重分布配置。

redis_progress

RedisProgress object

重分布进度信息。

redis_table_detail

RedisTableDetail object

重分布表信息。

表5 RedisConf

参数

参数类型

描述

redis_mode

String

重分布模式。

schedule_conf

ScheduleConf object

调度配置信息。

parallel_jobs

Integer

并行作业数量。

parallel_job

Integer

并行作业数量。

表6 ScheduleConf

参数

参数类型

描述

schedule_start

String

调度开始时间。

schedule_end

String

调度结束时间。

schedule_type

String

调度类型。

schedule_date

Array of integers

调度日期。

schedule_time

Array of strings

调度时间列表。

表7 RedisProgress

参数

参数类型

描述

bytes_done

Long

已完成字节数。

byte_left

Long

剩余字节数。

tables_done

Integer

完成表数量。

tables_left

Integer

剩余表数量。

table_progress

Integer

表重分布进度。

total_progress

Integer

总进度。

redis_rate

String

重分布比例。

estimated_time

String

预计时间。

completed

Boolean

是否已完成。

initialed

Boolean

是否完成初始化。

fail_count

Integer

失败总数。

redistributing

Boolean

cm_ctl 结果。

status

String

状态。

pause_by_user

Boolean

是否用户暂停。

表8 RedisTableDetail

参数

参数类型

描述

data

Array of RedisTable objects

具体数据。

total

Integer

总条数。

表9 RedisTable

参数

参数类型

描述

table_name

String

表名。

id

Integer

表唯一id。

schema_name

String

schema名。

logical_cluster_name

String

逻辑集群名。

size

Long

表大小。

status

String

重分布状态:

  • i:重分布中。
  • y:重分布完成。
  • n:未开始。

请求示例

GET https://{Endpoint}/v2/89cd04f168b84af6be287f71730fdb4b/clusters/e59d6b86-9072-46eb-a996-13f8b44994c1/redistribution

{
  "redis_mode" : "online",
  "parallel_jobs" : 3
}

响应示例

状态码: 200

查询重分布详情成功。

{
  "redis_info" : {
    "id" : "8e4cc873-577a-4ca0-8a8c-723ef84581a9",
    "cluster_id" : "f2175f2e-8379-4158-b521-6a961a952eb3",
    "start_time" : "2023-01-11 09:21",
    "end_time" : "2023-01-12 06:47",
    "status" : "SUCCESS",
    "redis_conf" : {
      "redis_mode" : "online",
      "schedule_conf" : {
        "schedule_start" : "2023/01/11 16:41:27",
        "schedule_end" : "2023/01/11 17:41:27",
        "schedule_type" : "timeRange",
        "schedule_date" : null,
        "schedule_time" : null
      },
      "parallel_jobs" : 4,
      "parallel_job" : 4
    },
    "redis_progress" : {
      "bytes_done" : 191746048,
      "byte_left" : 0,
      "tables_done" : 163,
      "tables_left" : 0,
      "table_progress" : 100,
      "total_progress" : 100,
      "redis_rate" : null,
      "estimated_time" : null,
      "completed" : true,
      "initialed" : true,
      "fail_count" : 0,
      "redistributing" : true,
      "status" : "SUCCESS",
      "pause_by_user" : false
    },
    "redis_table_detail" : null
  },
  "schedule_mode" : true,
  "pause_enable" : true,
  "recover_enable" : true,
  "retry_enable" : true,
  "update_enable" : true,
  "control_enable" : true
}

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
49
50
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.dws.v2.region.DwsRegion;
import com.huaweicloud.sdk.dws.v2.*;
import com.huaweicloud.sdk.dws.v2.model.*;


public class ShowClusterRedistributionSolution {

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

        DwsClient client = DwsClient.newBuilder()
                .withCredential(auth)
                .withRegion(DwsRegion.valueOf("cn-north-4"))
                .build();
        ShowClusterRedistributionRequest request = new ShowClusterRedistributionRequest();
        request.withLimit(<limit>);
        request.withOffset(<offset>);
        request.withDbName("<db_name>");
        request.withTableName("<table_name>");
        request.withType("<type>");
        try {
            ShowClusterRedistributionResponse response = client.showClusterRedistribution(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
33
34
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdws.v2.region.dws_region import DwsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdws.v2 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.getenv("CLOUD_SDK_AK")
    sk = os.getenv("CLOUD_SDK_SK")

    credentials = BasicCredentials(ak, sk) \

    client = DwsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DwsRegion.value_of("cn-north-4")) \
        .build()

    try:
        request = ShowClusterRedistributionRequest()
        request.limit = <limit>
        request.offset = <offset>
        request.db_name = "<db_name>"
        request.table_name = "<table_name>"
        request.type = "<type>"
        response = client.show_cluster_redistribution(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
39
40
41
42
43
44
45
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dws "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/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 := dws.NewDwsClient(
        dws.DwsClientBuilder().
            WithRegion(region.ValueOf("cn-north-4")).
            WithCredential(auth).
            Build())

    request := &model.ShowClusterRedistributionRequest{}
	limitRequest:= int32(<limit>)
	request.Limit = &limitRequest
	offsetRequest:= int32(<offset>)
	request.Offset = &offsetRequest
	dbNameRequest:= "<db_name>"
	request.DbName = &dbNameRequest
	tableNameRequest:= "<table_name>"
	request.TableName = &tableNameRequest
	typeRequest:= "<type>"
	request.Type = &typeRequest
	response, err := client.ShowClusterRedistribution(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

状态码

状态码

描述

200

查询重分布详情成功。

400

请求错误。

401

鉴权失败。

403

没有操作权限。

404

找不到资源。

500

服务内部错误。

503

服务不可用。

分享:

    相关文档

    相关产品