Definition定义
transitionFromDedicatedConfigServer
New in version 8.0.在版本8.0中新增。
Starting in MongoDB 8.0, you can:从MongoDB 8.0开始,您可以:
Configure a config server to store your application data in addition to the usual sharded cluster metadata. A config server that stores application data is called a config shard.配置配置服务器以存储应用程序数据以及通常的分片集群元数据。存储应用程序数据的配置服务器称为配置分片。Transition a config server between being a config shard and a dedicated config server.在配置分片和专用配置服务器之间转换配置服务器。
A cluster requires a config server, but it can be a config shard instead of a dedicated config server. Using a config shard reduces the number of nodes required and can simplify your deployment.集群需要一个配置服务器,但它可以是一个配置分片,而不是一个专用的配置服务器。使用配置分片可以减少所需的节点数量,并简化部署。
If your application has demanding availability and resiliency requirements, consider deploying a dedicated config server. A dedicated config server provides isolation, dedicated resources, and consistent performance for critical cluster operations.如果应用程序具有苛刻的可用性和弹性要求,请考虑部署专用配置服务器。专用配置服务器为关键集群操作提供隔离、专用资源和一致的性能。
The transitionFromDedicatedConfigServer command configures a dedicated config server to run as a config shard.transitionFromDedicatedConfigServer命令将专用配置服务器配置为作为配置分片运行。
Before you run 在运行transitionFromDedicatedConfigServer, connect to mongos and use the admin database.transitionFromDedicatedConfigServer之前,请连接到mongos并使用admin数据库。
The sharded cluster must have featureCompatibilityVersion set to at least 分片集群必须将8.0.featureCompatibilityVersion设置为至少8.0。
Syntax语法
Command syntax:命令语法:
db.adminCommand( {
transitionFromDedicatedConfigServer: 1
} )Behavior行为
The transitionFromDedicatedConfigServer command adds the config server as a shard in the cluster. Internally, transitionFromDedicatedConfigServer runs the addShard command.transitionFromDedicatedConfigServer命令将配置服务器作为分片添加到集群中。在内部,transitionFromDedicatedConfigServer运行addShard命令。
You can confirm that a sharded cluster uses a config shard by using one of the following methods:您可以使用以下方法之一确认分片集群使用配置分片:
Run the在sh.isConfigShardEnabled()method inmongosh.mongosh中运行sh.isConfigShardEnabled()方法。If the如果sh.isConfigShardEnabled()output containsenabled: true, the cluster uses a config shard. If the output containsenabled: false, the cluster does not use a config shard.sh.isConfigShardEnabled()输出包含enabled:true,则集群使用配置分片。如果输出包含enabled:false,则集群不使用配置分片。Run the在连接到listShardscommand against theadmindatabase while connected to amongosand inspect the output for a document where_idis set to"config".mongos时,对admin数据库运行listShards命令,并检查_id设置为"config"的文档的输出。If the如果listShardsoutput does not contain a document where_idis set to"config", the cluster does not use a config shard.listShards输出不包含_id设置为"config"的文档,则集群不使用配置分片。
For details, see Confirm use of Config Shard.有关详细信息,请参阅确认使用Config分片。
If you must downgrade the feature compatibility version below 8.0, first run the 如果必须将功能兼容性版本降级到8.0以下,请先运行transitionToDedicatedConfigServer command. For downgrade details, see Downgrade Feature Compatibility Version.transitionToDedicatedConfigServer命令。有关降级的详细信息,请参阅降级功能兼容性版本。
Access Control访问控制
If access control is enabled, the 如果启用了访问控制,则transitionFromDedicatedConfigServer command requires the transitionFromDedicatedConfigServer authorization action for the cluster:transitionFromDedicatedConfigServer命令要求对群集执行transitionFromDedicatedConfigServer授权操作:
{
resource: { cluster : true },
actions: [ "transitionFromDedicatedConfigServer" ]
}
The clusterManager role has transitionFromDedicatedConfigServer authorization action and can be assigned to a user.clusterManager角色具有从transitionFromDedicatedConfigServer授权操作转换,可以分配给用户。
The following example assigns the 以下示例将clusterManager role to a user named testUser:clusterManager角色分配给名为testUser的用户:
db.grantRolesToUser(
"testUser",
[ "clusterManager" ]
)Example示例
The following example configures a dedicated config server to run as a config shard:以下示例将专用配置服务器配置为作为配置分片运行:
db.adminCommand( {
transitionFromDedicatedConfigServer: 1
} )