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

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 the replSetStepDown command to make a different node in the replica set a primary.

提示

In mongosh, this command can also be run through the rs.freeze() helper method.

Helper methods are convenient for mongosh users, 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 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.

给本页内容打分