Docs Menu
Docs Home
/
MongoDB マニュアル
/ / /

clearJumboFlag

項目一覧

  • 定義
  • 互換性
  • 構文
  • アクセス制御
clearJumboFlag

チャンクのジャンボフラグをクリアします。 コマンドを使用するには、clearJumboFlag mongosインスタンスで コマンドを発行します。

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです

重要

このコマンドはサーバーレスインスタンスではサポートされていません。 詳細については、「サポートされていないコマンド 」を参照してください。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の 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 コマンドは、次のフィールドを引数として受け取ります。

フィールド
タイプ
説明
string

ジャンボ チャンクを含むシャーディングされた コレクション の 名前空間 。

データベース名を含むコレクションの完全な名前空間( <database><collection>"{database"."collection>")

配列

特定のチャンクの正確な境界。 配列は、移動するチャンクのシャードキーの下限と上限のシャードキー値を指定する 2 つのドキュメントで構成されている必要があります。

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

注意

ドキュメント

ジャンボ チャンクに含まれる特定の シャードキー とその値。

{ <shardKey> : <value> }

注意

  • 限界フィールドとfindフィールドのいずれかを指定しますが、両方は指定しないでください。

  • コレクションで ハッシュされたシャードキー が使用される場合は、 find フィールドを使用し ない でください。代わりに限界を使用してください。

authorizationclearJumboFlagで実行されているシステムでは、ユーザーは{ db: "", collection: "" } リソース に対して 特権アクションを持っている必要があります。

組み込みロールclusterManagerは適切な特権を提供します。

sh.status()には、 test.jumboコレクション用に次のsh.status.databases.<collection>.chunk-detailsが含まれています。

... // 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コレクションで ハッシュされたシャードキー が使用されている場合に、チャンクの フラグをクリアするには、 境界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)

Tip

以下も参照してください。

戻る

balancerStop