Copy set instance (version 4.0) connection description

Last updated: 2020-04-16 19:26:19

    The connection method for MongoDB replica set instances (v4.0) is different from that of other versions. 3 IPs are provided on v4.0 for access, corresponding to 3 nodes in a replica set. When connecting your business in a production environment, you are recommended to configure 3 IPs in the connection string to make the connection more secure and efficient.

    If only the IP of the master node is configured in the connection string, your business may face a read-only connection risk when a master/slave switchover occurs in the instance.

    Getting Connection String

    1. Log in to the TencentDB for MongoDB Console, purchase a replica set instance (v4.0), and perform initialization.
    2. In the instance list, click an instance name to enter the instance details page, click Copy connection string in the private address section to get the connection string of the instance for connecting to the replica set instance.
      Below is a sample connection string:
      mongodb://mongouser:******@192.168.x.xx:27017,192.168.x.xx:27017,192.168.x.xx:27017/admin?authSource=admin&replicaSet=cmgo-7oiab5db_0
    3. For more information on how to connect to a replica set instance in different connection methods, please see Connecting to Instances.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help