コレクションの移動の停止
You can stop moving an unsharded collection by using the
abortMoveCollection
command.
このタスクについて
To stop an in-progress moveCollection
operation, run the
abortMoveCollection
command on the admin
database.
アクセス制御
If your deployment has access control enabled,
the enableSharding
role allows you to run the
abortMoveCollection
command.
手順
Stop moving the collection
To stop moving a collection, run the abortMoveCollection
command. The following example stops the in-progress move of the
app.inventory
collection from shard01
to shard02
.
db.adminCommand( { abortMoveCollection: "app.inventory" } )
After you run the abortMoveCollection
command, the command output
returns ok: 1
and resembles the following:
{ ok: 1, '$clusterTime': { clusterTime: Timestamp( { t: 1726524884, i: 28 } ), signature: { hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0), keyId: Long('0') } }, operationTime: Timestamp({ t: 1726524884, i: 28 }) }
Confirm the move operation was stopped
To confirm the collection wasn't moved to the new shard, use the
$collStats
pipeline stage.
The following example shows how to confirm that the app.inventory
collection remains on the same shard:
db.inventory.aggregate( [ { $collStats: {} }, { $project: { "shard": 1 } } ] )
このパイプラインステージには、次のような出力があります。
[ { shard: 'shard01' } ]