Skip to Content
MongoDB权威指南(第3版)
book

MongoDB权威指南(第3版)

by Shannon Bradshaw, Eoin Brazil, Kristina Chodorow
November 2021
Intermediate to advanced
410 pages
12h 1m
Chinese
Posts & Telecom Press
Content preview from MongoDB权威指南(第3版)
管理
227
"force"
选项对其进行重新配置:
> rs.reconfig(config, {"force" : true})
强制重新配置与普通的重新配置遵循相同的规则:必须使用正确的选项,将有效且格式完
好的配置发送给成员。
"force"
选项不允许无效的配置,它的作用只是让从节点接受重新
配置命令。
强制重新配置会使副本集
"version"
字段的数字显著增加。你可能会看到它猛增了数万或
数十万。这些都是正常的:这是为了防止版本号冲突(以防网络分区的两边都在进行重新
配置)。
当从节点接收到重新配置时,它会更新自身的配置并将新配置传递给其他成员。副本集的
其他成员只有在识别出配置的发送者为当前配置中的一员时,才会对配置的更改有所察
觉。因此,如果一些成员已经改变了主机名,则应该在一个保持着旧主机名的成员上进行
强制重新配置。如果每个成员都有一个新的主机名,则应该关闭副本集中的每个成员,在
单机模式下启动,手动更改
local.system.replset
文档,然后重新启动成员。
13.3
 控制成员状态
有多种方式可以手动更改成员的状态以进行维护或应对负载的变化。但需要注意,无法强
制一个成员成为主节点,只能对副本集进行适当的配置,即为副本集成员设置高于任何其
他成员的优先级。
13.3.1
 把主节点变为从节点
可以使用
stepDown
函数将主节点降级为从节点:
> rs.stepDown()
这会使主节点降级为
SECONDARY
状态并维持
60
秒。如果在这段时间内没有其他主节点被选
举出来,那么这个节点可以尝试重新进行选举 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Spark快速大数据分析(第2版)

Spark快速大数据分析(第2版)

Jules S. Damji, Brooke Wenig, Tathagata Das, Denny Lee
Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty

Publisher Resources

ISBN: 9787115576538