I recently switched to the RockMongo browser , but I am having a hard time making it work with a replicaSet.
Per the official documentation , I declared the server as:
$MONGO["servers"][$i]["mongo_name"] = "localhost";//mongo server name
$MONGO["servers"][$i]["mongo_host"] = "127.0.0.1";//mongo host
$MONGO["servers"][$i]["mongo_port"] = "27017";//mongo port
$MONGO["servers"][$i]["mongo_timeout"] = 0;//mongo connection timeout
RockMongo complains with the following:
Execute failed:not master
function (){ return db.getCollectionNames(); }
I also tried another variant which resulted in the same error:
$MONGO["servers"][$i]["mongo_host"] = "mongodb://192.168.0.2,192.168.0.3";// multiple hosts
Can RockMongo work with a replicaSet?
But if you dive into the source code, you find that rockmongo can indeed connect to replicaSet using undocumented "mongo_options" key :
$MONGO["servers"][$i]["mongo_options"] = array('replicaSet' => 'REPLICA_NAME');//mongo server name
$MONGO["servers"][$i]["mongo_host"] = "mongodb://192.168.0.2,192.168.0.3";//mongo host
$MONGO["servers"][$i]["mongo_port"] = false;//mongo port
Hope this helps !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.