setAllowMigrations

On this page本页内容

Definition定义

setAllowMigrations

Prevents the start of new automatic migrations on a collection, prevents in-flight manual migrations from committing, and excludes the collection from new balancer rounds.防止对集合启动新的自动迁移,防止提交正在进行的手动迁移,并将集合排除在新的平衡器循环之外。

The command has the following syntax:该命令具有以下语法:

db.adminCommand( {
  setAllowMigrations: "<db>.<collection>",
  allowMigrations: <true|false>
} )

The command takes the following parameters:该命令采用以下参数:

Field字段Type类型Description描述
setAllowMigrationsstring

The collection to modify.要修改的集合。

allowMigrationsboolean

If false:如果为false

If true:如果为true

Behavior行为

setAllowMigrations requires the same privileges as moveChunk.需要与moveChunk相同的权限。

Example示例

This operation prevents migrations on the store.inventory collection:此操作阻止在store.inventory集合上进行迁移:

db.adminCommand( {
   setAllowMigrations: "store.inventory",
   allowMigrations: false
} )
←  reshardCollectionsetShardVersion →