Querying Shards and Replicas

Function

This API is used to query shards and replicas of Redis Cluster instances and instances that support read/write isolation. Only master/standby Redis 4.0 and 5.0 instances support read/write isolation.

This API is available only in the CN North-Beijing4 region.

URI

GET /v1.0/{project_id}/instance/{instance_id}/groups

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID.

Request

Request parameter

None

Example request

Request URL:

GET https://{dcs_endpoint}/v1.0/{project_id}/instance/{instance_id}/groups

Response

Response parameter

Table 1 Parameter description

Parameter

Type

Description

group_count

String

Total number of shards in the instance.

group_list

Array of objects

List of shards. For details, see Table 2.

Table 2 group_list parameter description

Parameter

Type

Description

group_id

String

Shard ID.

group_name

String

Shard name.

replication_list

Array of objects

List of replicas in the shard. For details, see Table 3.

Table 3 replication_list parameter description

Parameter

Type

Description

replication_ip

String

Replica IP address.

replication_role

String

Role of the replica. Options:

  • master: master
  • slave: replication

node_id

String

Node ID.

replication_id

String

Replica ID.

is_replication

Boolean

Indicates whether the replica is a newly added one.

status

String

Status of the replica.

Example response

When the status code is 200, the response parameters are as follows.

{
    "group_list": [
        {
            "group_id": "a11d3ba3-7898-4371-bfbe-783ab9280cc7",
            "group_name": "group-2",
            "replication_list": [
                {
                    "replication_ip": "192.168.0.156",
                    "replication_role": "master",
                    "node_id": "8aa6999f6de47c69016df0e7de1c23de",
                    "replication_id": "1a5f2b63-eedc-4bb1-a25f-262b5d604a1f",
                    "is_replication": false,
                    "status": "Active"
                },
                {
                    "replication_ip": "192.168.0.45",
                    "replication_role": "master",
                    "node_id": "8aa6999f6de47c69016df0e7de2e23df",
                    "replication_id": "2b892b07-dfe8-4b86-98cc-736b4e8e420f",
                    "is_replication": false,
                    "status": "Active"
                }
            ]
        },
        {
            "group_id": "2ba84ddc-558c-4465-bfe9-dbfaac024565",
            "group_name": "group-1",
            "replication_list": [
                {
                    "replication_ip": "192.168.0.95",
                    "replication_role": "master",
                    "node_id": "8aa6999f6de47c69016df0e7ddf623dc",
                    "replication_id": "b46cbcca-05a7-47b0-bd01-df768a1faf73",
                    "is_replication": false,
                    "status": "Active"
                },
                {
                    "replication_ip": "192.168.0.204",
                    "replication_role": "slave",
                    "node_id": "8aa6999f6de47c69016df0e7de0923dd",
                    "replication_id": "56ddd52e-0c95-40f2-a596-b578456c1431",
                    "is_replication": false,
                    "status": "Active"
                }
            ]
        },
        {
            "group_id": "995e1f3b-f9c0-4acf-ad9d-89123d1fd12a",
            "group_name": "group-0",
            "replication_list": [
                {
                    "replication_ip": "192.168.0.233",
                    "replication_role": "master",
                    "node_id": "8aa6999f6de47c69016df0e7ddd223da",
                    "replication_id": "71749f79-e9ea-4173-8bfa-b97357153af8",
                    "is_replication": false,
                    "status": "Active"
                },
                {
                    "replication_ip": "192.168.0.27",
                    "replication_role": "slave",
                    "node_id": "8aa6999f6de47c69016df0e7dde423db",
                    "replication_id": "707b7318-9766-47a8-91ad-7d0feab64229",
                    "is_replication": false,
                    "status": "Active"
                }
            ]
        }
    ],
    "group_count": 3
}

Return Value

Return Value

Description

200

Shards and replicas queried successfully.

Error Code

None