对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。

clearJumboFlag(数据库命令)

clearJumboFlag

清除数据段的巨型标志。 要使用该命令,请在 实例上发出clearJumboFlag mongos命令。

此命令可用于以下环境中托管的部署:

  • MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务

Th 命令采用以下语法:

db.adminCommand( { clearJumboFlag: "<database>.<collection>", bounds: <array> })

-或-

// Cannot use for collections with hashed shard keys db.adminCommand( { clearJumboFlag: "<database>.<collection>", find: <query> })

clearJumboFlag 命令将以下字段作为参数:

字段
类型
说明

字符串

具有巨型数据段的分片 集合 的 命名空间 。

指定集合的完整命名空间,包括数据库名称(即 "<database>.<collection>")

阵列

特定数据段的确切边界。 该数组必须由两个文档组成,这两个文档指定要移动的数据块的下限分片键值和上限分片键值:

[ { <shardKey> : <minValue> },{ <shardKey> : <maxValue> } ]

文档

巨型块中包含的特定分片键及其值。

{ <shardKey> : <value> }

在使用authorization 运行的系统上,用户必须具有对clearJumboFlag { db: "", collection: "" }资源 执行 操作 的权限。

内置角色clusterManager提供适当的权限。

sh.status()包括以下sh.status.databases.<collection>.chunk-details test.jumbo为collection。

... // 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" : Long("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" : Long("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()包括以下sh.status.databases.<collection>.chunk-details test.jumboHashed为collection 。collection使用哈希分片键。

... // Content omitted for brevity test.jumboHashed shard key: { "x" : "hashed" } unique: false balancing: true chunks: shardA 2 shardB 2 { "x" : { "$minKey" : 1 } } -->> { "x" : Long(0) } on : shardA Timestamp(1, 0) { "x" : Long(0) } -->> { "x" : Long("848411777775835583") } on : shardA Timestamp(4, 0) { "x" : Long("848411777775835583") } -->> { "x" : Long("5902408780260971510") } on : shardB Timestamp(4, 1) jumbo { "x" : Long("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)

要在集合使用哈希分片键时清除数据段的jumbo标志,请将clearJumboFlag与边界字段一起使用:

db.adminCommand( { clearJumboFlag: "test.jumboHashed", bounds: [{ "x" : Long("848411777775835583") }, { "x" : Long("5902408780260971510") }]} )

成功后,该命令会在输出中返回"ok": 1 :

{ "ok" : 1, "operationTime" : Timestamp(1580194290, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580194290, 5), "signature" : { "hash" : BinData(0,"nWCqOYVrab7NEGHWoo2NYENqHR4="), "keyId" : Long("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" : Long(0) } on : shardA Timestamp(1, 0) { "x" : Long(0) } -->> { "x" : Long("848411777775835583") } on : shardA Timestamp(4, 0) { "x" : Long("848411777775835583") } -->> { "x" : Long("5902408780260971510") } on : shardB Timestamp(5, 0) { "x" : Long("5902408780260971510") } -->> { "x" : { "$maxKey" : 1 } } on : shardB Timestamp(2, 2)
给本页内容打分