我创建了包含2个分片的群集。请检查下面的分片状态。
shards:
{ "_id" : "shard0000", "host" : "172.20.1.66:27021" }
{ "_id" : "shard0001", "host" : "172.20.1.66:27022" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "symfony", "partitioned" : false, "primary" : "shard0000" }
{ "_id" : "testDB", "partitioned" : true, "primary" : "shard0001" }
testDB.products
shard key: { "_id" : "hashed" }
chunks:
shard0001 2
{ "_id" : { "$minKey" : 1 } } -->> { "_id" : NumberLong(0) } on : shard0001 Timestamp(1, 0)
{ "_id" : NumberLong(0) } -->> { "_id" : { "$maxKey" : 1 } } on : shard0001 Timestamp(1, 1)
我插入了超过100000个文档,并尝试使用查询来获取数据。
db.products.find();
如下所示返回错误。
Error: error: {
"$err" : "setShardVersion failed shard: shard0001:172.20.1.66:27022 { oldVersion: Timestamp 0|0, oldVersionEpoch: ObjectId('000000000000000000000000'), ns: \"testDB.products\", version: Timestamp 1000|1, versionEpoch: ObjectId('5668170dbd53962a250383f8'), globalVersion: Timestamp 0|0, globalVersionEpoch: ObjectId('000000000000000000000000'), reloadConfig: true, ok: 0.0, errmsg: \"could not refresh metadata for testDB.products with requested shard version 1|1||5668170dbd53962a250383f8, stored shard version is 0|0||00000000000000...\" }",
"code" : 10429,
"shard" : "shard0001"
}
有人可以帮我解决这个问题。
答案 0 :(得分:4)
当某些服务器无法联系配置服务器时,我看到发生此错误。请确保:
mongos
实例可以联系配置服务器。mongod
个实例都可以联系配置服务器。另外,查看设置中所有服务器的日志并查找错误。