开发者

Why I can't read replicate data in MongoDB?

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.


You need to set slaveOk when querying from slaves.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜