Definição
clearJumboFlagClears the jumbo flag for a chunk. To use the command, issue the
clearJumboFlagcommand on amongosinstance.
Compatibilidade
Esse comando está disponível em implantações hospedadas nos seguintes ambientes:
- MongoDB Atlas: o serviço totalmente gerenciado para implantações do MongoDB na nuvem
MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB
MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB
Sintaxe
O comando tem a seguinte sintaxe:
db.adminCommand( { clearJumboFlag: "<database>.<collection>", bounds: <array> } )
-OU-
// Cannot use for collections with hashed shard keys db.adminCommand( { clearJumboFlag: "<database>.<collection>", find: <query> } )
Campos de comando
The clearJumboFlag command takes the following fields as arguments:
Campo | Tipo | Descrição |
|---|---|---|
string | ||
array | Os limites exatos de uma parte específica. A array deve consistir em dois documento que especificam os valores da chave de fragmento inferior e superior de uma parte a ser movida:
| |
documento | Uma chave de shard específica e seu valor contido no jumbo chunk.
|
Controle de acesso
Em sistemas executados com authorization, o usuário deve ter as ações de privilégio clearJumboFlag no recurso { db: "", collection: "" } .
O papel embutido clusterManager fornece os privilégios apropriados.
Exemplo
Limpar bandeira jumbo para um bloco (chave de fragmento baseada em intervalo)
O sh.status() inclui o seguinte sh.status.databases.<collection>.chunk-details para a collection 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)
The following clearJumboFlag command specifies the bounds of the { "x" : 1 } -->> { "x" : 2 } chunk:
db.adminCommand( { clearJumboFlag: "test.jumbo", bounds: [{ "x" : 1 }, { "x" : 2 }] } )
Após o sucesso, o comando retorna "ok": 1 em sua saída:
{ "ok" : 1, "operationTime" : Timestamp(1580190080, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580190080, 5), "signature" : { "hash" : BinData(0,"0cYT49s72MHUYV1F2WpoEwlyeVs="), "keyId" : Long("6786859092951433239") } } }
The following clearJumboFlag command specifies the find field to find the chunk that contains the shard key { "x" : 2 } :
db.adminCommand( { clearJumboFlag: "test.jumbo", find: { "x" : 2 } } )
Após o sucesso, o comando retorna "ok": 1 em sua saída:
{ "ok" : 1, "operationTime" : Timestamp(1580191819, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580191819, 5), "signature" : { "hash" : BinData(0,"N6x6drN7HUq5MR5ezUJns1rfeqY="), "keyId" : Long("6786859092951433239") } } }
Para verificar a operação, execute sh.status() novamente. O sinalizador jumbo não deve mais aparecer em sua saída.
... // 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)
Limpar bandeira jumbo para uma parte (chave de fragmento com hash)
O sh.status() inclui o seguinte sh.status.databases.<collection>.chunk-details para a collection test.jumboHashed . A collection usa uma chave de fragmento com hash.
... // 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)
To clear the jumbo flag for a chunk if the collection uses a hashed shard key, use clearJumboFlag with the bounds field:
db.adminCommand( { clearJumboFlag: "test.jumboHashed", bounds: [{ "x" : Long("848411777775835583") }, { "x" : Long("5902408780260971510") }] } )
Após o sucesso, o comando retorna "ok": 1 em sua saída:
{ "ok" : 1, "operationTime" : Timestamp(1580194290, 5), "$clusterTime" : { "clusterTime" : Timestamp(1580194290, 5), "signature" : { "hash" : BinData(0,"nWCqOYVrab7NEGHWoo2NYENqHR4="), "keyId" : Long("6786875525496307742") } } }
Para verificar a operação, execute sh.status() novamente. O sinalizador jumbo não deve mais aparecer em sua saída.
... // 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)