Help Center> GaussDB> API Reference> APIs (Recommended)> Instance Management> Querying the Components of a DB Instance
Updated on 2024-05-21 GMT+08:00

Querying the Components of a DB Instance

Function

This API is used to query components of a DB instance. Before calling this API:

URI

GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/components
Table 1 Parameter description

Name

Type

Mandatory

Description

project_id

String

Yes

Project ID of a tenant in a region.

For details about how to obtain the project ID, see Obtaining a Project ID.

instance_id

String

Yes

DB instance ID.

limit

Integer

No

Number of records to be queried. The default value is 100. The value cannot be a negative number. The minimum value is 1 and the maximum value is 100. For example, if this parameter is set to 10, a maximum of 10 records can be displayed.

offset

Integer

No

Index offset. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number. For example, if this parameter is set to 0 and limit is set to 10, only the 1st to 10th records are displayed.

component_type

String

No

Component type. If this parameter is ALL (default value), all types of components are queried. CM: CMS components Value:

  • ALL
  • CN
  • DN
  • CM
  • GTM
  • ETCD

availability_zone_id

String

No

ID of the AZ where the primary component is located. The default value is ALL, indicating that component information of nodes in all AZs of the instance is queried. When you query the AZ where a primary DN is located, the information of all DNs in the same shard as the primary DN is displayed. When you query the AZ where a CN is located, only the CN information in the AZ is displayed. When you query the AZ where a component (except CNs or DNs) is located, information about all components of the same type is returned. If there is no such a component, no information is returned.

Request Parameters

None

Response Parameters

Table 2 Parameter description

Name

Type

Description

nodes

Array of objects

Component details.

For details, see Table 3.

total_count

Integer

Total number of records.

Table 3 nodes description

Name

Type

Description

id

String

Node ID.

components

Array of objects

Component information under the instance node. For details, see Table 4.

name

String

Node name.

availability_zone_id

String

Code of the AZ where the node is located.

description

String

AZ description.

status

String

Node status.

Table 4 components description

Name

Type

Description

id

String

Component ID.

  • Global Transaction Manager (GTM): manages the status of transactions.
  • Cluster Management Server (CMS): manages the instance status.
  • Data Node (DN): Stores and queries table data.
  • Coordinator nodes (CNs): stores database metadata, distributes and executes query tasks, and then returns the query results from DNs to applications.
  • Editable Text Configuration Daemon (ETCD): serves as a distributed key-value storage system used for configuration sharing and service discovery (registration and search).

role

String

Node role.

  • master: primary node
  • slave: standby node

status

String

Component status.

  • Primary: primary component
  • Normal: The component is normal.
  • Down: The component is abnormal.
  • Standby: standby component
  • StateFollower: standby ETCD
  • StateLeader: primary ETCD
  • StateCandidate: arbitration ETCD

distributed_id

String

Group ID. This parameter is used to identify DNs in the same shard. For other components, the value is an empty string.

Example Request

Querying the components of a DB instance

GET https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/dd93e98e103b4fc4b5a978a6bd6f03a9in14/components

Example Response

Instance components queried.
{
    "nodes": [
        {
            "components": [
                {
                    "id": "cm_1",
                    "role": "master",
                    "status": "Primary",
                    "distributed_id": ""
                },
                {
                    "id": "etcd_7001",
                    "role": "master",
                    "status": "StateLeader",
                    "distributed_id": ""
                },
                {
                    "id": "dn_6001",
                    "role": "master",
                    "status": "Primary",
                    "distributed_id": "60011"
                }
            ],
            "id": "7d19f72f8f514564bd92962a6fbddb7dno14",
            "name": "gauss-9e1a_root_0",
            "availability_zone_id": "cn-southwest-244a",
            "description": "az1",
            "status": "normal"
        },
        {
            "components": [
                {
                    "id": "cm_3",
                    "role": "slave",
                    "status": "Standby",
                    "distributed_id": ""
                },
                {
                    "id": "etcd_7003",
                    "role": "slave",
                    "status": "StateFollower",
                    "distributed_id": ""
                },
                {
                    "id": "dn_6003",
                    "role": "slave",
                    "status": "Standby",
                    "distributed_id": "60011"
                }
            ],
            "id": "aafc2e14234d4c9eadb481fb0a09a865no14",
            "name": "gauss-9e1a_root_2",
            "availability_zone_id": "cn-southwest-244a",
            "description": "az1",
            "status": "normal"
        },
        {
            "components": [
                {
                    "id": "cm_2",
                    "role": "slave",
                    "status": "Standby",
                    "distributed_id": ""
                },
                {
                    "id": "etcd_7002",
                    "role": "slave",
                    "status": "StateFollower",
                    "distributed_id": ""
                },
                {
                    "id": "dn_6002",
                    "role": "slave",
                    "status": "Standby",
                    "distributed_id": "60011"
                }
            ],
            "id": "d6c6c6e6b48c41d79d99d7240751d744no14",
            "name": "gauss-9e1a_root_1",
            "availability_zone_id": "cn-southwest-244a",
            "description": "az1",
            "status": "normal"
        }
    ],
    "total_count": 3
}

Status Code

Error Code

For details, see Error Codes.