Hello,
I have cluster with many shards - I need to downscale with shards.
I have jumbo chunks - so shard draining is stucked on jumbo chunks.
I can use command to move jumbo chunk like this:
db.adminCommand( { moveChunk : “myDatabaseName.myShardedCollectionName”, bounds : [ c.min, c.max ], to : “s1”, maxChunkSizeBytes: 8192 * 1024 * 1024 );
This works, but I have many of those and I would like to script it somehow but I have issues with NumberLong.
my chunk looks like:
{
“id" : "mydb.mycol-deviceId-6121561864734330913”,
“lastmod” : Timestamp(26, 1),
“lastmodEpoch” : ObjectId(“6128989e7624b46716f49452”),
“ns” : “mydb.mycol”,
“min” : {
“deviceId” : NumberLong(“-6121561864734330913”)
},
“max” : {
“deviceId” : NumberLong(“-6118577678503421902”)
},
“shard” : “rs_1”,
“jumbo” : true,
“history” : [
{
“validAfter” : Timestamp(1630050462, 340),
“shard” : “rs_1”
}
]
}
and my code looks like:
db.chunks.find({jumbo:true}).forEach(function(doc){
printjson(doc);
var bound_min = JSON.stringify(doc.min)
var bound_max = JSON.stringify(doc.max)
print(bound_min)
print(bound_max)
print(“db.adminCommand( { moveChunk : "” + doc.ns + “", bounds : [ " + bound_min + “,” + bound_max +” ], to : "rs_0", maxChunkSizeBytes: 8192 * 1024 * 1024 })");
})
output is:
{“deviceId”:{“$numberLong”:“-6121561864734330913”}}
{“deviceId”:{“$numberLong”:“-6118577678503421902”}}
db.adminCommand( { moveChunk : “mydb.mycol”, bounds : [ {“deviceId”:{“$numberLong”:“-6121561864734330913”}},{“deviceId”:{“$numberLong”:“-6118577678503421902”}} ], to : “rs_0”, maxChunkSizeBytes: 8192 * 1024 * 1024 })
but Mongo complains there’s no such chunk…
Any ideas? THX!