clearJumboFlag
定义
clearJumboFlag
清除大块的标志。要使用此命令,请在
clearJumboFlag
命令上对mongos
实例进行操作。
兼容性
此命令在以下环境中托管的部署中可用
MongoDB Atlas:MongoDB云部署的全托管服务
重要
此命令不支持在无服务器实例中。有关更多信息,请参阅不支持命令。
MongoDB Enterprise:基于订阅的自托管MongoDB版本
MongoDB Community:源代码可用、免费使用和自托管MongoDB版本
语法
该命令具有以下语法
db.adminCommand( { clearJumboFlag: "<database>.<collection>", bounds: <array> } )
-OR-
// Cannot use for collections with hashed shard keys db.adminCommand( { clearJumboFlag: "<database>.<collection>", find: <query> } )
命令字段
命令 clearJumboFlag
接受以下字段作为参数
字段 | 类型 | 描述 |
---|---|---|
string | 具有大块(jumbo chunk)的分区 命名空间 的集合。 指定集合的完整命名空间,包括数据库名(即 “<database>.<collection>”) | |
array | ||
document |
访问控制
在启用 authorization
的系统上,用户必须在 { db: "", collection: "" }
资源 上具有 clearJumboFlag
权限操作。
内置角色 clusterManager
提供了适当的权限。
示例
清除数据块的大块标记(基于范围的分区键)
以下sh.status()
包含了 sh.status.databases.<collection>.chunk-details
,这是对 test.jumbo
集合的。
... // Content omitted for brevity test.jumbo shard key: { "x" : 1 } unique: false balancing: true chunks: shardA 2 shardB 2 { "x" : { "$minKey" : 1 } } -->> { "x" : 1 } on : shardB Timestamp(3, 0) { "x" : 1 } -->> { "x" : 2 } on : shardA Timestamp(6, 1) jumbo { "x" : 2 } -->> { "x" : 3 } on : shardA Timestamp(5, 1) jumbo { "x" : 3 } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(6, 0)
以下 clearJumboFlag
命令指定了 { "x" : 1 } -->> { "x" : 2 }
数据块的 边界
db.adminCommand( { clearJumboFlag: "test.jumbo", bounds: [{ "x" : 1 }, { "x" : 2 }] } )
命令成功执行后,其输出将返回 "ok": 1
{ "ok" : 1, "operationTime" : Timestamp(1580190080, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580190080, 5), "signature" : { "hash" : BinData(0,"0cYT49s72MHUYV1F2WpoEwlyeVs="), "keyId" : NumberLong("6786859092951433239") } } }
以下 clearJumboFlag
命令指定了 查找字段以查找包含分区键 { "x" : 2 }
的数据块
db.adminCommand( { clearJumboFlag: "test.jumbo", find: { "x" : 2 } } )
命令成功执行后,其输出将返回 "ok": 1
{ "ok" : 1, "operationTime" : Timestamp(1580191819, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580191819, 5), "signature" : { "hash" : BinData(0,"N6x6drN7HUq5MR5ezUJns1rfeqY="), "keyId" : NumberLong("6786859092951433239") } } }
为了验证操作,请再次运行 sh.status()
。其输出中不应再出现 jumbo
标记。
... // Content omitted for brevity test.jumbo shard key: { "x" : 1 } unique: false balancing: true chunks: shardA 2 shardB 2 { "x" : { "$minKey" : 1 } } -->> { "x" : 1 } on : shardB Timestamp(3, 0) { "x" : 1 } -->> { "x" : 2 } on : shardA Timestamp(7, 0) { "x" : 2 } -->> { "x" : 3 } on : shardA Timestamp(8, 0) { "x" : 3 } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(6, 0)
清除数据块的大块标记(基于哈希的分区键)
方法 sh.status()
包含以下关于 test.jumboHashed
集合的信息 sh.status.databases.<collection>.chunk-details
。该集合使用哈希分片键。
... // Content omitted for brevity test.jumboHashed shard key: { "x" : "hashed" } unique: false balancing: true chunks: shardA 2 shardB 2 { "x" : { "$minKey" : 1 } } -->> { "x" : NumberLong(0) } on : shardA Timestamp(1, 0) { "x" : NumberLong(0) } -->> { "x" : NumberLong("848411777775835583") } on : shardA Timestamp(4, 0) { "x" : NumberLong("848411777775835583") } -->> { "x" : NumberLong("5902408780260971510") } on : shardB Timestamp(4, 1) jumbo { "x" : NumberLong("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)
如果集合使用哈希分片键,要清除一个数据块上的 jumbo
标志,请使用带有 bounds 字段的 clearJumboFlag
db.adminCommand( { clearJumboFlag: "test.jumboHashed", bounds: [{ "x" : NumberLong("848411777775835583") }, { "x" : NumberLong("5902408780260971510") }] } )
命令成功执行后,其输出将返回 "ok": 1
{ "ok" : 1, "operationTime" : Timestamp(1580194290, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580194290, 5), "signature" : { "hash" : BinData(0,"nWCqOYVrab7NEGHWoo2NYENqHR4="), "keyId" : NumberLong("6786875525496307742") } } }
为了验证操作,请再次运行 sh.status()
。其输出中不应再出现 jumbo
标记。
... // Content omitted for brevity test.jumboHashed shard key: { "x" : "hashed" } unique: false balancing: true chunks: shardA 2 shardB 2 { "x" : { "$minKey" : 1 } } -->> { "x" : NumberLong(0) } on : shardA Timestamp(1, 0) { "x" : NumberLong(0) } -->> { "x" : NumberLong("848411777775835583") } on : shardA Timestamp(4, 0) { "x" : NumberLong("848411777775835583") } -->> { "x" : NumberLong("5902408780260971510") } on : shardB Timestamp(5, 0) { "x" : NumberLong("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)