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 !

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

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏