Help Center/ Document Database Service/ API Reference/ APIs V3.0 (Recommended)/ Connection Management/ Querying the Number of Connections to an Instance Node
Updated on 2025-08-22 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

  • URI example

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

Request Parameters

Parameter description

Table 1 Request parameters

Name

Type

IN

Mandatory

Description

X-Auth-Token

string

header

Yes

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

project_id

string

path

Yes

Definition

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

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

string

path

Yes

Definition

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.

Constraints

N/A

Range

N/A

Default Value

N/A

node_id

string

query

No

Definition

The node ID.

Constraints

N/A

Range

N/A

Default Value

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

Response Parameters

  • Response parameters
    Table 2 Response body parameters

    Parameter

    Type

    Mandatory

    Description

    total_connections

    Integer

    Yes

    Definition

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

    Range

    N/A

    total_inner_connections

    Integer

    Yes

    Definition

    The total number of internal connections.

    Range

    N/A

    total_outer_connections

    Integer

    Yes

    Definition

    The total number of external connections.

    Range

    N/A

    inner_connections

    Array of objects

    Yes

    Definition

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

    Range

    N/A

    outer_connections

    Array of objects

    Yes

    Definition

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

    Range

    N/A

    Table 3 Data structure description of the inner_connections and outer_connections fields

    Parameter

    Type

    Mandatory

    Description

    client_ip

    String

    Yes

    Definition

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

    Range

    N/A

    count

    Integer

    Yes

    Definition

    The number of connections corresponding to the IP address.

    Range

    N/A

Example Request

  • Querying the connection statistics of all nodes in a DB instance
    GET https://dds.ap-southeast1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/cc6345c64cec47499182467ea0dd432ain02/conn-statistics
  • Querying the connection statistics of a node in a DB instance
    GET https://dds.ap-southeast1.myhuaweicloud.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/ cc6345c64cec47499182467ea0dd432ain02/conn-statistics?node_id=51a90da2cfc846688abcdd23861077b5no02

Example Response

Status code: 200

Success.
{    
  "total_connections" : 75,  
  "total_inner_connections" : 50, 
  "total_outer_connections" : 25,   
  "inner_connections" : [ {     
   "client_ip" : "10.10.10.24",    
   "count" : 9   
  }, {     
   "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.