在mongodb中找不到与主机匹配的读取首选项 [英] could not find host matching read preferences in mongodb

查看:1266
本文介绍了在mongodb中找不到与主机匹配的读取首选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分片环境中的新数据库中创建一个新集合.

I am creating a new collection in a new database on the sharded environment.

coll.insertMany(list)时出现以下错误.

Exception in thread "main" com.mongodb.MongoCommandException: 
Command failed with error 133: 'unable to target write op for collection dbname.collection:: caused by :: 
FailedToSatisfyReadPreference: Could not confirm non-existence of database "dbname" due to inability to query the config server primary :: caused by :: 
FailedToSatisfyReadPreference: could not find host matching read preference { mode: "primary" } for set csReplSet' on server ip:27017. 
The full response is { "ok" : 0, "code" : 133, "errmsg" : "unable to target write op for collection dbname.collection:: caused by :: 
FailedToSatisfyReadPreference: Could not confirm non-existence of database \"dbname\" due to inability to query the config server primary :: caused by :: 
FailedToSatisfyReadPreference: could not find host matching read preference { mode: \"primary\" } for set csReplSet" }

推荐答案

读取首选项"似乎会给您带来麻烦.

It looks like Read Preference is creating problem in your end.

请通过阅读首选项进行设置,然后设置更适合您的应用程序

Please go thru read preference and set which is more appropriate for your application

https://docs.mongodb.com/manual/reference/read-preference /

如果您的问题与jira中提到的问题有关,那么我们需要mongo版本3.3.11,目前我们只有

If your issue is something related to the one which is mentioned in below jira then we need mongo version 3.3.11 and currently we have only 3.2.9 released.

https://jira.mongodb.org/browse/SERVER-22620

这篇关于在mongodb中找不到与主机匹配的读取首选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆