duanqiang9212 2012-05-21 14:28
浏览 163
已采纳

如何为Mongodb副本集配置RoboMongo

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?

  • 写回答

1条回答 默认 最新

  • doutuo6048 2012-05-21 14:29
    关注

    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 !

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)