[英]MongoDB query issue on cluster
我創建了具有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"
}
有人可以幫我解決這個問題。
我看到當某些服務器無法聯系配置服務器時發生此錯誤。 請確保:
mongos
實例可以聯系配置服務器。 mongod
實例都可以聯系配置服務器。 另外,查看設置中所有服務器的日志並查找錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.