定义
replSetFreezeThe
replSetFreezecommand prevents a replica set member from seeking election for the specified number of seconds. Use this command in conjunction with thereplSetStepDowncommand to make a different node in the replica set a primary.提示
In
mongosh, this command can also be run through thers.freeze()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
兼容性
此命令可用于以下环境中托管的部署:
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
重要
MongoDB Atlas 集群不支持此命令。有关 Atlas 对所有命令的支持的信息,请参阅不支持的命令。
语法
该命令具有以下语法:
db.runCommand( { replSetFreeze: <seconds> } )
行为
如果要在指定的秒数之前解冻副本集节点,可以发出带有秒值0的命令:
db.runCommand( { replSetFreeze: 0 } )
重新启动mongod进程也会解冻副本集成员。
replSetFreeze is an administrative command, and you must issue it against the admin database.