"$err" : "not master and slaveok=false", "code" : 13435

mchdba發表於2014-03-05

monbodb安裝完之後, 啟動準備新增使用者報錯.

> use admin
switched to db admin
> db.addUser("admin","admin",false);
Wed Apr 24 14:17:26 uncaught exception: error { "$err" : "not master and slaveok=false", "code" : 13435 }
>

 

去check下 install 以及start 過程

/usr/local/mongodb/bin/mongod  -f  /etc/mongodb/37017.conf

 

有啟動引數在 /etc/mongodb/37017.conf 配置檔案裡面

[root@mongo ~]# more /etc/mongodb/37017.conf
dbpath = /db/db1
port = 37017
rest = true
fork = true
logpath = /etc/mongodb/mongodb.log
logappend = true
replSet = sso-rest

 

我這臺mongodb是單機,所以這個引數估計不合理,也許是這裡報錯, 註釋掉

#replSet = sso-rest

 

重新啟動mongodb:

/usr/local/mongodb/bin/mongod  -f  /etc/mongodb/37017.conf

 

再登陸重新執行db.addUser("admin","admin",false);

OK !

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26230597/viewspace-1101276/,如需轉載,請註明出處,否則將追究法律責任。

相關文章