Get Started Sign In

Finding the replica set name of a MongoDB cluster

When you protect a MongoDB cluster with Cyral, you must specify the cluster's replica set name. To get this name, there are three options.

Method 1. Extract it from the MongoShell connection URI

  1. On the cluster main page, click on the connect button:
  2. Select the Connect with the MongoDB Shell option
  3. Select MongoDB Shell version 3.4 or earlier

The replicaSet name should be listed as part of the connection string:


Method 2. Connect to the cluster and extract the information

Access the MongoDB cluster (not authentication required) and issue the following commands:

use admin


The db.isMaster() command should return the details about the cluster topology, which includes the replica set name:


    "topologyVersion" : {

        "counter" : NumberLong(7),

        "processId" : ObjectId("60f998149a67f8675309a2b4")


    "hosts" : [





    "setName" : "MyCluster-shard-0",

    "ismaster" : true,

    "me" : "",

    "setVersion" : NumberLong(6),

    "primary" : "",


The name is associated with the key setName:

"setName" : "MyCluster-shard-0", 


Method 3. Get the Set Name by resolving the SRV cluster endpoint

If you have access to the cluster SRV (mongodb+srv) endpoint, you can resolve it to get the Replica Set name. For example, for the cluster endpoint: mongodb+srv://, we can resolve it using the CLI tool nslookup:

$ ▶ nslookup -type=TXT

Non-authoritative answer:    text = "authSource=admin&replicaSet=MyCluster-shard-0"

The above output contains the Replica Set name as part of the text response:



Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.