replSetFreeze
定义
replSetFreeze
The
replSetFreeze
command prevents a replica set member from seeking election for the specified number of seconds. Use this command in conjunction with thereplSetStepDown
command to make a different node in the replica set a primary.提示
在
mongosh
中,该命令也可通过rs.freeze()
辅助方法运行。辅助方法对
mongosh
用户来说很方便,但它们返回的信息级别可能与数据库命令不同。如果不追求方便或需要额外的返回字段,请使用数据库命令。
兼容性
此命令可用于以下环境中托管的部署:
MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
该命令具有以下语法:
db.runCommand( { replSetFreeze: <seconds> } )
行为
If you want to unfreeze a replica set member before the specified number
of seconds has elapsed, you can issue the command with a seconds
value of 0
:
db.runCommand( { replSetFreeze: 0 } )
Restarting the mongod
process also unfreezes a replica
set member.
replSetFreeze
is an administrative command, and you
must issue it against the 管理库.