Enabling IP Addresses of shard and config Nodes

Scenarios

A cluster instance of Community Edition consists of mongos, shard, and config nodes. When your services need to read and write data from and into databases, connect to the mongos node. In certain scenarios, you need to read data from the shard or config node. Therefore, obtaining the IP address of the corresponding node is necessary.

This section describes how to obtain the IP addresses of the shard and config nodes.

Before You Start

  • DDS supports cluster instances of Community Edition 3.2, 3.4, 4.0, 4.2, and 4.4.

  • DDS creates two connection addresses for the primary node and secondary node in a shard respectively.

  • Once the connection addresses are assigned to your nodes, they cannot be modified or deleted.

  • The connection address is accessible from private networks only.

Enabling shard IP Address

  1. Log in to the DDS console.

  2. In the left navigation pane, choose Instance Management. In the DB instance list, click the target cluster instance to go to the Basic Information page.

    Alternatively, on the Basic Information page, in the navigation pane on the left, click Connections.

  3. In the Node Information area, click the shard tab.

  4. Click Show shard IP Address. In the displayed dialog box, enter and confirm the password for connecting to the node.

    Note

    • After the shard IP address is enabled, you need to restart the corresponding shard nodes for the configuration to take effect.

    • The shard IP address cannot be modified or disabled after being enabled, and the password cannot be modified.

    • After the shard IP address is enabled and new shard nodes are added, you need to manually locate the newly added shard node and choose More > Show shard IP Address in the Operation column to show the shard IP address.

    • After the shard IP address is enabled, all shard nodes in the current instance apply for connection addresses.

  5. Obtain the private IP address of the shard node.

    After the shard IP address is enabled, you can click Connections in the navigation pane on the left or on the current page to expand the node drop-down list and obtain the private IP address.

  6. Obtain the connection address of a shard node.

    Example:

    Based on the private IP address obtained in 5, the connection address of the current shard node is as follows:

    mongodb://sharduser:<password>@192.168.237.15:8637,192.168.255.217:8637/test?authSource=admin&replicaSet=shard_?

    Note

    • sharduser is the default user when setting up "show shard IP address" function.

    • <password>indicates the password of the sharduser.

    • 192.168.237.15 and 192.168.255.217 are the private IP addresses of the shard's primary and secondary nodes.

    • 8637 is the port of the shard node and cannot be changed.

    • shard_? indicates the name of the shard node to be connected, for example, shard_1.

Enabling config IP Address

  1. Log in to the DDS console.

  2. In the left navigation pane, choose Instance Management. In the DB instance list, click the target cluster instance to go to the Basic Information page.

    Alternatively, on the Basic Information page, in the navigation pane on the left, click Connections.

  3. In the Node Information area, click the config tab.

  4. Click Show config IP Address. In the displayed dialog box, enter and confirm the password for connecting to the node.

    Note

    • After the config IP address is enabled, you need to restart the corresponding config node for the configuration to take effect.

    • The config IP address cannot be modified or disabled after being enabled, and the password cannot be modified.

  5. Obtain the private IP address of the config node.

    After the config IP address is enabled, you can click Connections in the navigation pane on the left or on the current page to expand the node drop-down list and obtain the private IP address.

  6. Obtain the connection address of a config node.

    Example:

    Based on the private IP address obtained in 5, the connection address of the current config node is as follows:

    mongodb://csuser:<password>@192.168.154.71:8636,192.168.143.227:8636/test?authSource=admin&replicaSet=config

    Note

    • csuser indicates the username of the current config node.

    • <password>indicates the password of the csuser.

    • 192.168.154.71 and 192.168.143.227 are the private IP addresses of the current node.

    • 8636 is the port of the config node and cannot be changed.