Replica sets, sharded clusters, SRV and load balancers

Choose the right connection type for a standalone server, a replica set, a sharded cluster, an SRV seedlist or a load-balanced deployment.

The Connection Type: on the Server tab of the connection dialog tells the application how your deployment is laid out. A pasted connection string sets it for you.

Choose the connection type

  1. Open the connection dialog, Server tab.
  2. Pick the Connection Type: from the table below and fill in its fields.
  3. On the Advanced tab, set the Read Preference: if you want to read from secondaries.
  4. Test Connection, then Save.
Connection TypeFieldsConnection string
StandaloneServer:, Port:mongodb://db.acme.example.com:27017
Replica SetMembers: (one host and port per line), Replica Set Name:mongodb://db1...,db2...,db3.../?replicaSet=rs0
Sharded ClusterHosts: (the mongos routers)mongodb://mongos1...,mongos2.../
DNS Seedlist (mongo+srv connections)Server: (the SRV name), Replica Set Name:, SRV Service Name (optional):mongodb+srv://cluster0.acme.example.com/

Replica sets

The application discovers the other members from those you list, follows elections, and reads from the member chosen by the read preference (Primary by default). Read preference tags can be set with Edit Preference Tags on the Advanced tab. Hovering the connection in the connection tree shows its servers and their state, the server version and the read preference.

SRV seedlists

A mongodb+srv:// name is resolved through DNS (the Retrieving DNS Records step) into the list of servers and some options. TLS is on by default for SRV connections. Use Convert DNS Seedlist Connections to Standard Format when exporting if the receiver cannot resolve SRV records.

Load-balanced deployments

For a deployment behind a load balancer, tick Enable Load Balanced on the Advanced tab (or put loadBalanced=true in the connection string) and give the load balancer’s address as a standalone server.

Tips

  • One reachable member is enough to connect to a replica set, but list several so the connection still opens when one is down.
  • The connection tree shows the server version; features a server’s version lacks are greyed out with the reason in their tooltip.

Troubleshooting

SymptomWhat to do
Replica set connection fails although a member answersCheck Replica Set Name:: it must match the set’s configured name exactly. Members must be reachable by the names the set advertises (use an SSH tunnel if those names are private).
SRV connection fails at Retrieving DNS RecordsYour DNS cannot resolve the SRV/TXT records; try another network, or a standard connection string.