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版)
356
22
无论选择哪种技术,都需要提前计划以尽量减少对应用程序的影响。进行备份,依次修改
集合中的每个成员,将数据从一个地方复制到另一个地方,这些操作都需要时间。
22.5
 监控复制情况
复制延迟和
oplog
长度是需要跟踪的重要指标。延迟是指从节点无法跟上主节点的速度。
它的计算方法是,将应用在从节点上最后一个操作的时间减去主节点上最后一个操作的时
间。如果从节点刚刚应用了时间戳为
3:26:00 p.m.
的操作
,而主节点刚刚应用了时间戳为
3:29:45 p.m.
的操作
,那么从节点的延迟就是
3
45
秒。延迟应该尽可能接近于
0
,并且
通常是毫秒级别的。如果从节点能够与主节点保持同步,那么复制延迟应该如图
22-9
示,即基本上始终为
0
复制延迟
22-9:没有延迟的副本集,这是我们希望看到的
如果从节点复制写操作的速度比主节点的写入速度慢,就会出现非零的延迟。最极端的情
况是当复制过程卡住时:由于某种原因,从节点不能应用更多的操作。此时,延迟将以
“每秒一秒”
1
的速度增长,形成如图
22-10
所示的陡坡。这可能是由于网络问题或缺少
"_id"
索引造成的,要使复制正常工作,每个集合都需要这个索引。
复制延迟
22-10:复制发生了阻塞,在 2 10 日之前才开始恢复,垂直线表示服务器的重启
1
由于同步被完全阻塞,因此每过一秒都会使延迟增加一秒。
监控
MongoDB
357
如果一个集合缺少
"_id"
索引,则将服务器从副本集中脱离并作为单机服务
器启动,然后创建
"_id"
索引。确保将
"_id" ...
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