Question

I have created a replica Set with 4 MongoD running. port: 2017, 2018, 2019, 2020

Very standard. I followed the instruction as in the documentation.

Then I set 2020 be the primary one. And then I insert data.

Then I go back and login to another one. e.g. ./mongo localhost:2017

and try to do a find(). it returns:

error: { "$err" : "not master", "code": 10107}

Why ?? I tried on other replicates and all gave me the same error.


I also notice that I get this error in the mongod output when I insert data.

 Failed to allocate new file: /home/ec2-user/db/r04/test.1, size: 134217728, aborting.

I'm no clue what's going on yet.

Was it helpful?

Solution

You need to set slaveOk when querying from slaves.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top