查询重分布详情
功能介绍
该接口用于查看当前集群的重分布模式、重分布进度、数据表重分布详情等监控信息。
查看重分布详情功能DWS 2.0 8.1.1.200及以上集群版本支持,其中数据表重分布进度详情仅DWS 2.0 8.2.1及以上集群版本支持。
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/clusters/{cluster_id}/redistribution
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释: 项目ID。获取方法请参见获取项目ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
cluster_id |
是 |
String |
参数解释: 集群ID。获取方法请参见获取集群ID。 约束限制: 必须是有效的dws集群ID。 取值范围: 36位UUID。 默认取值: 不涉及。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
limit |
否 |
Integer |
参数解释: 分页查询,每页大小。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 10 |
offset |
否 |
Integer |
参数解释: 分页偏移量,从0开始,页数减1。 约束限制: 不涉及。 取值范围: 大于等于0 默认取值: 0 |
db_name |
否 |
String |
参数解释: 数据库名称。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: null |
table_name |
否 |
String |
参数解释: 表名称。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: null |
type |
否 |
String |
参数解释: 类型,取值来自public.pgxc_redistb表的redistributed字段。多个可用逗号分割。 约束限制: 不涉及。 取值范围: i:重分布中; y:已完成; n:未开始; 默认取值: null,即不过滤。 |
请求参数
无
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
redis_info |
RdsRedisInfo object |
参数解释: 重分布信息。 取值范围: 不涉及。 |
schedule_mode |
Boolean |
参数解释: 调度模式。 取值范围: false:非调度模式;true:调度模式。 |
pause_enable |
Boolean |
参数解释: 是否允许暂停。 取值范围: false:不允许暂停;true:允许暂停。 |
recover_enable |
Boolean |
参数解释: 是否允许恢复。 取值范围: false:不允许恢复;true:允许恢复。 |
retry_enable |
Boolean |
参数解释: 是否允许重试。 取值范围: false:不允许重试;true:允许重试。 |
update_enable |
Boolean |
参数解释: 是否允许更新。 取值范围: false:不允许更新;true:允许更新,该参数仅仅适用于调度模式。 |
control_enable |
Boolean |
参数解释: 是否允许控制。 取值范围: false:不允许控制;true:允许控制,该参数仅仅适用于调度模式。 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释: 重分布信息ID。 取值范围: 不涉及。 |
cluster_id |
String |
参数解释: 集群ID。 取值范围: 不涉及。 |
start_time |
String |
参数解释: 开始时间。 取值范围: 不涉及。 |
end_time |
String |
参数解释: 结束时间。 取值范围: 不涉及。 |
status |
String |
参数解释: 状态。 取值范围: PREPARE|RUNNING|WAITING|PAUSE|PAUSING|SUCCESS|FAIL。 |
redis_conf |
RedisConf object |
参数解释: 重分布配置。 取值范围: 不涉及。 |
redis_progress |
RedisProgress object |
参数解释: 重分布进度信息。 取值范围: 不涉及。 |
redis_table_detail |
RedisTableDetail object |
参数解释: 重分布表信息。 取值范围: 不涉及。 |
参数 |
参数类型 |
描述 |
---|---|---|
redis_mode |
String |
参数解释: 重分布模式。 取值范围: online|offline。 |
schedule_conf |
ScheduleConf object |
参数解释: 调度配置信息。 取值范围: 不涉及。 |
parallel_jobs |
Integer |
参数解释: 重分布并发数。 取值范围: 1~200。 |
parallel_job |
Integer |
参数解释: 重分布并发数,已经废弃。 取值范围: 1~200。 |
priority_policy |
String |
参数解释: 优先级策略。 取值范围: large:优先对大表进行重分布。 small:优先对小表进行重分布 default:默认顺序进行重分布。 |
bucket_split_info |
BucketSplitInfo object |
参数解释: 桶分裂信息。 取值范围: 不涉及。 |
参数 |
参数类型 |
描述 |
---|---|---|
schedule_start |
String |
参数解释: 调度开始时间。 取值范围: 不涉及。 |
schedule_end |
String |
参数解释: 调度结束时间。 取值范围: 不涉及。 |
schedule_type |
String |
参数解释: 调度类型。 取值范围: 不涉及。 |
schedule_date |
Array of integers |
参数解释: 调度日期。 取值范围: 不涉及。 |
schedule_time |
Array of strings |
参数解释: 调度时间列表。 取值范围: 不涉及。 |
参数 |
参数类型 |
描述 |
---|---|---|
current_dn_num |
Integer |
参数解释: 当前DN数。 取值范围: 不涉及。 |
after_scale_out_dn_num |
Integer |
参数解释: 扩容后DN数。 取值范围: 不涉及。 |
current_bucket_num |
Integer |
参数解释: 当前bucket数。 取值范围: 不涉及。 |
after_scale_out_bucket_num |
Integer |
参数解释: 扩容后bucket数。 取值范围: 不涉及。 |
is_bucket_split |
Boolean |
参数解释: 扩容是否涉及bucket分裂。 取值范围: 不涉及。 |
bucket_tilt_rate |
String |
参数解释: bucket DN倾斜率,用于衡量bucket在DN节点上不均衡程度。 取值范围: 不涉及。 |
after_scale_out_bucket_tilt_rate |
String |
参数解释: 扩容后 bucket DN倾斜率,用于衡量扩容后bucket在DN节点上不均衡程度。 取值范围: 不涉及。 |
参数 |
参数类型 |
描述 |
---|---|---|
bytes_done |
Long |
参数解释: 已完成字节数。 取值范围: 不涉及。 |
byte_left |
Long |
参数解释: 剩余字节数。 取值范围: 不涉及。 |
tables_done |
Integer |
参数解释: 完成表数量。 取值范围: 不涉及。 |
tables_left |
Integer |
参数解释: 剩余表数量。 取值范围: 不涉及。 |
table_progress |
Integer |
参数解释: 表重分布进度。 取值范围: 1~100。 |
total_progress |
Integer |
参数解释: 总进度。 取值范围: 1~100。 |
redis_rate |
String |
参数解释: 重分布速度。 取值范围: 不涉及。 |
estimated_time |
String |
参数解释: 预估时间。 取值范围: 不涉及。 |
completed |
Boolean |
参数解释: 是否已完成。 取值范围: 不涉及。 |
initialed |
Boolean |
参数解释: 是否完成初始化。 取值范围: 不涉及。 |
fail_count |
Integer |
参数解释: 失败次数。 取值范围: 不涉及。 |
redistributing |
Boolean |
参数解释: cm_ctl查询的重分布结果。 取值范围: 不涉及。 |
status |
String |
参数解释: 状态。 取值范围: 不涉及。 |
pause_by_user |
Boolean |
参数解释: 是否用户暂停。 取值范围: 不涉及。 |
参数 |
参数类型 |
描述 |
---|---|---|
data |
Array of RedisTable objects |
参数解释: 重分布具体数据。 取值范围: 不涉及。 |
total |
Integer |
参数解释: 重分布表张数。 取值范围: 不涉及。 |
请求示例
查询重分布详情。
GET https://{Endpoint}/v2/89cd04f168b84af6be287f71730fdb4b/clusters/e59d6b86-9072-46eb-a996-13f8b44994c1/redistribution { "redis_mode" : "online", "parallel_jobs" : 3 }
响应示例
状态码:200
查询重分布详情成功。
{ "error_msg" : null, "redis_info" : { "id" : "1e1006ae-5243-4989-9452-c0217ad08776", "cluster_id" : "37e6956b-17dd-4aef-980d-8ebd9c29f887", "start_time" : "2025-05-15 14:04", "end_time" : "", "status" : "PAUSE", "redis_conf" : { "redis_mode" : "online", "schedule_conf" : null, "parallel_jobs" : 4, "priority_policy" : "default", "bucket_split_info" : { "current_dn_num" : 3, "after_scale_out_dn_num" : 6, "current_bucket_num" : 32, "after_scale_out_bucket_num" : 32, "is_bucket_split" : false, "bucket_tilt_rate" : "9.09%", "after_scale_out_bucket_tilt_rate" : "16.67%" } }, "redis_progress" : { "bytes_done" : 7219200, "byte_left" : 0, "tables_done" : 95, "tables_left" : 230, "table_progress" : 29, "total_progress" : 31, "redis_rate" : "21 MB/s", "estimated_time" : "00:12:06", "completed" : false, "initialed" : true, "fail_count" : 0, "redistributing" : true, "status" : "FAIL", "pause_by_user" : false }, "redis_table_detail" : { "data" : [ { "table_name" : "test_69", "id" : 2147492808, "schema_name" : "public", "logical_cluster_name" : "v3_logical", "size" : 77815808, "status" : "i" }, { "table_name" : "test_171", "id" : 2147493123, "schema_name" : "public", "logical_cluster_name" : "v3_logical", "size" : 77815808, "status" : "i" }, { "table_name" : "test_236", "id" : 2147493327, "schema_name" : "public", "logical_cluster_name" : "v3_logical", "size" : 77815808, "status" : "i" } ], "total" : 3 } }, "schedule_mode" : false, "pause_enable" : false, "recover_enable" : true, "retry_enable" : false, "update_enable" : false, "control_enable" : false }
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.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"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); DwsClient client = DwsClient.newBuilder() .withCredential(auth) .withRegion(DwsRegion.valueOf("<YOUR REGION>")) .build(); ShowClusterRedistributionRequest request = new ShowClusterRedistributionRequest(); request.withClusterId("{cluster_id}"); 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 |
# coding: utf-8 import os 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.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DwsClient.new_builder() \ .with_credentials(credentials) \ .with_region(DwsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowClusterRedistributionRequest() request.cluster_id = "{cluster_id}" 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 |
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") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dws.NewDwsClient( dws.DwsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowClusterRedistributionRequest{} request.ClusterId = "{cluster_id}" 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 |
服务不可用。 |