Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to use rockmongo, to connect to our cluster.

Our setup is a setup of two shards each consisting of a replicaset. I try to connect to the mongos instance and while rockmongo connects I get an error when trying to list the dbs:

Execute failed:not master function (){ return db.getCollectionNames(); }

This has something to do with the replica sets and everybody points to:

$MONGO["servers"][$i] = array("replicaSet" => "xxxxx");

This is all fine, but I have two replicasets and as far as I understand I should connect to the mongos instance and not directly to the members of the set.

So how does one use rockmongo to connect to a mongo sharded setup with replicasets?

share|improve this question

When you are running in a sharded setup you should not be connecting to the replica sets individually, rather you just connect to mongos and it will proxy connections back to the appropriate shard. Have you tried replacing your current config to point to just the mongos host (and port) rather than the replica set?

I assume no, since the mongos would not return the "not master" error. Given that error though I would also take a look at each replica set individually and run rs.status() to verify your replica sets each have a primary.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.