我有一个4个shard mongo集群,我存储的所有文档都会进入一个分片。我使用我的RDBMS表中的主键(序列号)作为分片键。我是初学者,想知道这是否与任何配置有关,在哪里看?
Shard rs1 at rs1/10.158.66.183:27020,10.158.66.184:27020
data : 148.57Gb docs : 39100284 chunks : 1
estimated data per chunk : 148.57Gb
estimated docs per chunk : 39100284
Totals
data : 148.57Gb docs : 39100284 chunks : 1
Shard rs1 contains 100% data, 100% docs in cluster, avg obj size on shard : 3kb
sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"version" : 4,
"minCompatibleVersion" : 4,
"currentVersion" : 5,
"clusterId" : ObjectId("537c935b2158e8ca4fea274a")
}
shards:
{ "_id" : "rs0", "host" : "rs0/HOST1:27020,HOST2:27020" }
{ "_id" : "rs1", "host" : "rs1/HOST3:27020,HOST4:27020" }
{ "_id" : "rs2", "host" : "rs2/HOST5:27020,HOST6:27020" }
{ "_id" : "rs3", "host" : "rs3/HOST7:27020,HOST7:27020" }
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : true, "primary" : "rs0" }
test.students
shard key: { "grades" : 1 }
chunks:
rs0 1
{ "grades" : { $minKey : 1 } } -->> { "grades" : { $maxKey : 1 } } on : rs0 Timestamp(1000, 0)
{ "_id" : "foo", "partitioned" : true, "primary" : "rs1" }
{ "_id" : "db1", "partitioned" : true, "primary" : "rs1" }
db1.collection1
shard key: { "_id" : 1, "name" : 1 }
chunks:
rs1 1
{ "_id" : { $minKey : 1 }, "name" : { $minKey : 1 } } -->> { "_id" : { $maxKey : 1 }, "name" : { $maxKey : 1 } } on : rs1 Timestamp(1000, 0)
{ "_id" : "db", "partitioned" : false, "primary" : "rs0" }
{ "_id" : "collection1", "partitioned" : true, "primary" : "rs0" }
答案 0 :(得分:0)
删除了群集配置(对于配置服务器,副本集)并重新启动。之后,Sharding为我的收藏品工作。