How to install compass while MongoDB server is a 3 nodes primary/secondary cluster on Ununtu?

Dear MongoDB compass experts,

I am new to MongoDB, and just installed MongoDB server is a 3-server primary/secondary cluster on Ununtu servers. I want to install compass so that I could administrate the MongoDB on my laptop (which runs Windows 10). In other words, the MongoDB cluster is on Ubuntu on remote machines, but I want to use compass on my laptop which run Windows.
I have the following questions:

  1. Where should I install compass? On my laptop (windows10), or on the Ubuntu host ?
  2. Since the MongoDB server is a primary/secondary cluster (1 primary + 2 secondary, each has different hostname and IP address). As you know, sometimes if the primary is down, one of the secondary will become the primary, hence how to let compass know the situation and hence always connect to the right server ? Or compass could automatically detect this?

I appreciate your kind help!
BigMDBFan

Use a connection string(paste when you connect, and then make it a ‘favourite’.

image

mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=yourReplSetName

The connection string is made up of ‘seed’ nodes that the client(compass) will connect to and connection options. The host is interrogated and the full list of replicaset hosts are returned.

For small replicasets the seed hosts are all the member. In a larger replicaset you could just select a host from each faliure domain.

The full description of the uri format is:

Thanks for the detailed explanation.

Another question, where should I install compass? On laptop (which I prefer for easy interaction with compass) or on Linux (where MongoDB server are installed) ?

This is a tool I would install on my workstation or an appropriate machine used for administering the DB’s/Environment.

In compass, I met the following error when I pasted the connection string of the 3-replica repliset server

“An error occurred while loading navigation: command hostInfo requires authentication”

The string is:
mongodb://myserver1:27017,myserver2:27017,myserver3:27017/?replicaSet=rs0

Did I miss anything here? Also, in the connection string where could I put the uid/pwd credential ?

I appreciate your kind help !

There is a lot to take in on the page but it is there:

mongodb://[username:password@]host1[:port1][,…hostN[:portN]][/[defaultauthdb][?options]]

mongodb://BigMDBFan:IreadYourEmail@myserver1:27017,myserver2:27017,myserver3:27017/?replicaSet=rs0

1 Like