Mongodb Mongo均衡器不迁移基于标记的块
我已经配置了一个双碎片集群,并添加了以下标记Mongodb Mongo均衡器不迁移基于标记的块,mongodb,Mongodb,我已经配置了一个双碎片集群,并添加了以下标记 shards: { "_id" : "shard0000", "host" : "mongo-db1:27018", "tags" : [ "shard-product1" ] } { "_id" : "shard0001", "host" : "mongo-db3:27018", "tags" : [ "shard-product2" ] } sh.addTagRange("mydb.product
shards:
{ "_id" : "shard0000", "host" : "mongo-db1:27018", "tags" : [ "shard-product1" ] }
{ "_id" : "shard0001", "host" : "mongo-db3:27018", "tags" : [ "shard-product2" ] }
sh.addTagRange("mydb.products", { product : "product1", sno: MinKey}, {product : "product1", sno: MaxKey}, "shard-product1")
sh.addTagRange("mydb.products", { product : "product2", sno: MinKey}, {product : "product2", sno: MaxKey}, "shard-product2")
下面是给定集合的sh.status的输出
{ "_id" : "mydb", "partitioned" : true, "primary" : "shard0000" }
mydb.products
shard key: { "product" : 1, "sno" : 1 }
chunks:
shard0000 3
{ "product" : { "$minKey" : 1 }, "sno" : { "$minKey" : 1 } } -->> { "product" : "product1", "sno" : { "$minKey" : 1 } } on : shard0000 Timestamp(1, 1)
{ "product" : "product1", "sno" : { "$minKey" : 1 } } -->> { "product" : "product2", "sno" : { "$minKey" : 1 } } on : shard0000 Timestamp(1, 3)
{ "product" : "product2", "sno" : { "$minKey" : 1 } } -->> { "product" : { "$maxKey" : 1 }, "sno" : { "$maxKey" : 1 } } on : shard0000 Timestamp(1, 4)
tag: shard-product1 { "product" : "product1", "sno" : { "$minKey" : 1 } } -->> { "product" : "product1", "sno" : { "$maxKey" : 1 } }
tag: shard-product2 { "product" : "product2", "sno" : { "$minKey" : 1 } } -->> { "product" : "product2", "sno" : { "$maxKey" : 1 } }
当我向products集合添加条目时,两个产品的所有条目都将添加到主shard shard-product1
上述配置是否存在任何问题
提前感谢平衡器正在运行吗?请与sh.getBalancerState联系。集合中有多少数据?product1和product2是product的唯一值吗?sh.getBalancerState返回false。此外,我还阅读了其他内容,其中只有在达到区块迁移阈值时才会触发平衡器。我尝试使用sh.startBalancer手动运行平衡器,但没有任何效果。@wdberkeley-product1,product2是product的唯一值。我添加的所有条目都是针对product1和product2的。数据的大小为代码{count:41,size:83312,storageSize:172032}code。我也试着运行这篇文章中的步骤,但无法进行预拆分。看起来,我有一个基本的配置问题。是否有我可能缺少的任何配置选项?