Mongo平衡器不基于标签迁移块

时间:2014-12-05 02:09:47

标签: mongodb

我已经配置了两个分片群集并添加了以下标记。

  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 } }

当我向产品系列添加条目时,所有条目(两个产品)都被添加到主分片(shard-product1)。

上面的配置有问题吗?

提前致谢

0 个答案:

没有答案