Querying Redistribution Details
Function
This API is used to view monitoring information about the current cluster, such as the redistribution mode, redistribution progress, and redistribution details. Only GaussDB(DWS) 2.0, 8.1.1.200, and later versions support the function of viewing redistribution details. Only GaussDB(DWS) 2.0, 8.2.1, and later versions support the function of viewing redistribution progress details.
Call Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/clusters/{cluster_id}/redistribution
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the ID, see Obtaining Project ID. |
cluster_id |
Yes |
String |
Cluster ID. For details about how to obtain the ID, see Obtaining the Cluster ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Size of each page to be queried |
offset |
No |
Integer |
Offset for the pagination query |
db_name |
No |
String |
Database name |
table_name |
No |
String |
Table name |
type |
No |
String |
Type. |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
redis_info |
RdsRedisInfo object |
Redistribution information |
schedule_mode |
Boolean |
Scheduling mode |
pause_enable |
Boolean |
Whether suspension is allowed |
recover_enable |
Boolean |
Whether resuming is allowed |
retry_enable |
Boolean |
Whether retry is allowed |
update_enable |
Boolean |
Whether update is allowed |
control_enable |
Boolean |
Whether control is allowed |
Parameter |
Type |
Description |
---|---|---|
id |
String |
ID. |
cluster_id |
String |
Cluster ID. |
start_time |
String |
Start time |
end_time |
String |
End time |
status |
String |
Running status |
redis_conf |
RedisConf object |
Redistribution configuration |
redis_progress |
RedisProgress object |
Redistribution progress |
redis_table_detail |
RedisTableDetail object |
Redistribution table information |
Parameter |
Type |
Description |
---|---|---|
redis_mode |
String |
Redistribution mode |
schedule_conf |
ScheduleConf object |
Scheduling configuration information |
parallel_jobs |
Integer |
Number of parallel jobs |
parallel_job |
Integer |
Number of parallel jobs |
Parameter |
Type |
Description |
---|---|---|
schedule_start |
String |
Scheduling start time |
schedule_end |
String |
Scheduling end time |
schedule_type |
String |
Scheduling type |
schedule_date |
Array of integers |
Scheduling date |
schedule_time |
Array of strings |
Scheduling time list |
Parameter |
Type |
Description |
---|---|---|
bytes_done |
Long |
Number of completed bytes |
byte_left |
Long |
Number of remaining bytes |
tables_done |
Integer |
Completed tables |
tables_left |
Integer |
Remaining tables |
table_progress |
Integer |
Table redistribution progress |
total_progress |
Integer |
Overall progress |
redis_rate |
String |
Redistribution ratio |
estimated_time |
String |
Estimated time |
completed |
Boolean |
Completed or not |
initialed |
Boolean |
Initialized or not |
fail_count |
Integer |
Total number of failures |
redistributing |
Boolean |
cm_ctl result |
status |
String |
Running status |
pause_by_user |
Boolean |
Whether it is suspended by the user |
Parameter |
Type |
Description |
---|---|---|
data |
Array of RedisTable objects |
Detailed data |
total |
Integer |
Total records |
Parameter |
Type |
Description |
---|---|---|
table_name |
String |
Table name |
id |
Integer |
Unique ID of a table |
schema_name |
String |
Schema name |
logical_cluster_name |
String |
Logical cluster name |
size |
Long |
Table size |
status |
String |
Redistribution Status
|
Example Request
GET https://{Endpoint}/v2/89cd04f168b84af6be287f71730fdb4b/clusters/e59d6b86-9072-46eb-a996-13f8b44994c1/redistribution { "redis_mode" : "online", "parallel_jobs" : 3 }
Example Response
Status code: 200
The redistribution details are queried.
{ "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 Sample Code
The sample code is as follows:
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) } } |
For more SDK sample codes of programming languages, visit API Explorer and click the Sample Code tab. Example codes can be automatically generated.
Status Code
Status Code |
Description |
---|---|
200 |
The redistribution details are queried. |
400 |
Request error. |
401 |
Authentication failed. |
403 |
You do not have required permissions. |
404 |
No resources found. |
500 |
Internal server error. |
503 |
The service was unavailable. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot