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

getTransitionToDedicatedConfigServerStatus(数据库命令)

getTransitionToDedicatedConfigServerStatus

显示从嵌入式配置服务器到专用配置服务器的转换状态。

如果转换失败,该命令将返回 ok: 0 并显示错误,否则将返回 ok: 1

要开始转换到专用配置服务器,请参阅 startTransitionToDedicatedConfigServer 命令。

要停止正在进行的从嵌入式配置服务器到专用配置服务器的转换,请参阅 stopTransitionToDedicatedConfigServer 命令。

要提交从嵌入式配置服务器到专用配置服务器的转换,请参阅 commitTransitionToDedicatedConfigServer 命令。

8.3版本新增。

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

注意

This command is not supported in MongoDB Atlas. See Modify your Atlas Sharded Cluster to drain the embedded config server.

该命令具有以下语法:

db.adminCommand( {
getTransitionToDedicatedConfigServerStatus: 1
} )

此命令返回以下输出:

字段
类型
说明

msg

字符串

提供负载负载均衡器当前正在执行的排干操作。

state

字符串

提供到专用配置服务器的转换状态。

remaining

文档

显示在完全过渡到专用配置服务器之前,负载均衡器必须执行以清空分片的剩余任务。

remaining.chunks

long

表示仍在分片上的数据段数。

remaining.dbs

long

指示仍在分片上的数据库数量。

remaining.jumboChunks

long

表示仍在分片上的数据块的数量。

remaining.collectionsToMove

long

表示仍在分片上的集合数量。

remaining.estimatedRemainingBytes

long

Estimated number of bytes remaining on the shard undergoing removal.

note

字符串

为用户提供附加消息。

dbsToMove

阵列

指示用作主分片的排干分片的数据库。在完全过渡到专用配置服务器之前,您必须使用 movePrimary 命令手动将这些数据库移动到新的分片。

collectionsToMove

阵列

表示存储在排干分片上的未分片集合。在完全过渡到专用配置服务器之前,您必须使用 moveCollection 命令手动将这些集合移动到另一个分片。

pendingRangeDeletions

long

The number of pending range deletions remaining on the shard undergoing removal. Present only during a transitionToDedicatedConfigServer operation, after the balancer has moved all chunks and databases off the config server.

firstNonEmptyCollection

字符串

The first non-empty collection on the shard undergoing removal. Present only during a transitionToDedicatedConfigServer operation, after the balancer has moved all chunks and databases off the config server.

如果已启用authorization ,则必须具有clusterManager角色或任何包含removeShard操作的角色。

如果嵌入式配置服务器也是集群一个数据库的主节点 (primary node in the replica set),则在迁移分片的所有数据后,您必须手动将数据库移至新分片。有关更多信息,请参阅 movePrimary 命令和 从分片集群中删除分片

如果其中一个未分片的集合位于嵌入式配置服务器上,则必须先将该集合迁移到其他分片。

要迁移未分片集合,请参阅 moveCollection 命令。

要开始过渡到专用配置服务器,请使用 db.adminCommand() 方法运行 startTransitionToDedicatedConfigServer 命令:

db.adminCommand( { startTransitionToDedicatedConfigServer: 1 } )

要检查排干操作的状态,请使用 getTransitionToDedicatedConfigServerStatus 命令:

db.adminCommand( { getTransitionToDedicatedConfigServerStatus: 1 } )
{
"state" : "ongoing",
"remaining" : {
"chunks" : NumberLong(2),
"collectionsToMove" : NumberLong(1),
"dbs" : NumberLong(1),
"jumboChunks" : NumberLong(0),
"estimatedRemainingBytes" : NumberLong(18)
},
"msg" : "draining ongoing",
"dbsToMove" : [
"testDB"
],
"note" : "you need to call moveCollection for collectionsToMove and afterwards movePrimary for the dbsToMove",
"collectionsToMove" : [
"testDB.testCollUnsharded"
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1772210444, 27),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1772210444, 27)
}