未捕获的异常:错误:{“$ err”:“not master and slaveOk = false”,“code”:13435}

时间:2014-02-09 17:10:52

标签: mongodb

运行db.getMongo().setSlaveOk()后;当我从secondery节点访问集合时,仍然会出现错误。根据我的理解,我应该能够从辅助节点看到它的数据。

uncaught exception: error: { "$err" : "not master and slaveOk=false", "code" : 13435 }

我使用下面的命令来创建副本集

mkdir D:\data\repdb\One mkdir D:\data\repdb\The mkdir D:\data\repdb\Two mongod --port 27017 --dbpath D:\data\repdb\One --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27018 --dbpath D:\data\repdb\The --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27019 --dbpath D:\data\repdb\Two --replSet rs0 --smallfiles --oplogSize 128 mongo --port 27017 rsconf = { "_id" : "rs0", "version" : 1, "members" : [ { "_id" : 1, "host" : "localhost:27017" } ] }

rs.initiate( rsconf )

rs.conf()

rs.add("localhost:27018") rs.add("localhost:27019")

1 个答案:

答案 0 :(得分:1)

您是否在次要成员上尝试:rs.slaveOk()

相关问题