Help Center/ Document Database Service/ API Reference/ APIs V3.0 (Recommended)/ Connection Management/ Querying the Number of Connections to an Instance Node
Updated on 2023-11-24 GMT+08:00

Querying the Number of Connections to an Instance Node

Description

This API is used to query the number of connections from each client to DDS DB instances.

Restrictions

Frozen instances do not support this operation.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/conn-statistics?node_id={node_id}

  • URI example

    https://dds.ap-southeast1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/cc6345c64cec47499182467ea0dd432ain02/conn-statistics?node_id=51a90da2cfc846688abcdd23861077b5no02

Requests

Parameter description

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

User token obtained from IAM. For details, see Authentication.

project_id

string

path

Yes

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

instance_id

string

path

Yes

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

node_id

string

query

No

The node ID.

If this parameter is left blank, the number of connections of all nodes that can be connected in the instance is queried by default.

Responses

  • Response parameters
    Table 2 Response body parameters

    Parameter

    Type

    Mandatory

    Description

    total_connections

    Integer

    Yes

    The total number of connections, including internal and external connections.

    total_inner_connections

    Integer

    Yes

    The total number of internal connections.

    total_outer_connections

    Integer

    Yes

    The total number of external connections.

    inner_connections

    Array of objects

    Yes

    The internal connection statistics array. Up to 200 records are supported. For details, see Table 3.

    outer_connections

    Array of objects

    Yes

    The external connection statistics array. Up to 200 records are supported. For details, see Table 3.

    Table 3 Data structure description of the inner_connections and outer_connections fields

    Parameter

    Type

    Mandatory

    Description

    client_ip

    String

    Yes

    The IP address of the client connected to the instance or node.

    count

    Integer

    Yes

    The number of connections corresponding to the IP address.

  • Response example
    {
        "total_connections": 75,
        "total_inner_connections": 50,
        "total_outer_connections": 25,
        "inner_connections": [
            {"client_ip": "10.10.10.24", "count": 19},
            {"client_ip": "9.3.185.42", "count": 6},
            {"client_ip": "10.10.4.156", "count": 3}
        ],
        "outer_connections": [
            {"client_ip": "10.10.10.25", "count": 11},
            {"client_ip": "9.3.185.46", "count": 8},
            {"client_ip": "10.10.4.157", "count": 4}
        ]
    }

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.