MongoDb "not master and slaveok=false" error and solution

The following errors were found in SECONDARY query:

SECONDARY> show collections;
Sat Aug  4 15:29:00 uncaught exception: error: { "$err" : "not master and slaveok=false", "code" : 13435 }

This is normal, because SECONDARY is not allowed to read and write. If you have to solve it, the method is as follows:

SECONDARY> rs.slaveOk();

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326103776&siteId=291194637