All Products
Search
Document Center

ApsaraDB for MongoDB:Connect to a replica set instance by using DMS

Last Updated:Apr 15, 2025

This topic describes how to use Data Management (DMS) to connect to a replica set instances for remote access and online management. DMS is an integrated and visualized database solution that offers data management, structure management, user authorization, security auditing, data trend analysis, data tracking, BI charts, performance optimization, and server management.

Preparations

You have added the IP address of your DMS server to a whitelist of the instance based on the instance network type.

Note

Skip this step if you have added the IP address of the DMS server to a whitelist of the instance.

Figure 1: IP addresses available for the DMS server

Network type of the instance

IP address of the DMS server

Virtual Private Cloud (VPC)

100.104.0.0/16

Classic network

120.55.177.0/24

121.43.18.0/24

101.37.74.0/24

10.153.176.0/24

10.137.42.0/24

11.193.54.0/24

10.152.163.0/24

Procedure

  1. Log on to the ApsaraDB for MongoDB console .

  2. In the left-side navigation pane, click Replica Set Instances.

  3. In the upper-left corner of the page, select the resource group and region to which the desired instance belongs.

  4. Click the ID of the instance that you want to manage or click Manage in the Actions column.

  5. In the upper-right corner of the page that appears, click Log On and select Primary, Secondary, or Readonly. Then, you are redirected to the DMS page.

    Note
    • Primary: the primary node in the replica set instance. If you connect to this node, you can perform both read and write operations on the databases of the replica set instance.

    • Secondary: secondary nodes in the replica set instance. If you connect to a secondary node, you can perform only read operations on the databases of the replica set instance.

    • Readonly: read-only nodes in the replica set instance. If you connect to a read-only node, you can perform only read operations on the databases of the replica set instance.

  6. In the Log on to Database Instance dialog box, configure the parameters described in the following table.

    Parameter

    Description

    Database Type

    The engine of the database. By default, the engine of the database to be connected is selected.

    Instance Region

    The region in which the instance is deployed. By default, the region of the current instance is selected.

    Connection String Address

    The endpoint of the instance. By default, the endpoint of the current instance is displayed.

    Database Name

    The name of the authentication database in which the database account is created.

    Note
    • If Database Account is set to root, the database name is admin.

    • We recommend that you do not log on to a database as the root user in the production environment. You can create a user and grant permissions based on your requirements. For more information, see Manage user permissions on MongoDB databases.

    Security hosting

    The instance for which you enable security hosting enters the logon-free state. For more information about how to enable security hosting, see Security hosting.

    Database Account

    The account that is used to access the database. The initial account is root.

    Database Password

    The password of the database account.

    Note

    If you forget the password of the root account, you can reset the password.

    Control Mode

    The mode that you use to manage the instance. Select a control mode based on your business requirements.

  7. Click Login.

    Note

    If you want the browser to save the password, select Remember password and then click Login.

Common connection scenarios

FAQ