【MongoDB】MongoDb的“not master and slaveok=false”錯誤及解決方法 mongo連接從庫出現問題


鏈接mongodb報錯如下

2016-03-14T16:26:00.912+0800 E QUERY    [thread1] Error: listDatabases failed:{ "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435 } :
_getErrorWithCode@src/mongo/shell/utils.js:23:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:53:1
shellHelper.show@src/mongo/shell/utils.js:700:19
shellHelper@src/mongo/shell/utils.js:594:15
@(shellhelp2):1:1

 

錯誤代碼:

Error: listDatabases failed:{ "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435 }

這是正常的,因為mgset-742285:SECONDARY是不允許讀寫的,如果非要解決,方法如下:

mgset-742285:SECONDARY> rs.slaveOk();


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM