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版)
配置分片
261
15.4
 均衡器
均衡器
负责数据的迁移。它会定期检查分片之间是否存在不均衡,如果存在,就会对块进
行迁移。在
MongoDB 3.4
以上的版本中
,均衡器位于配置服务器副本集的主节点成员上,
而在
MongoDB 3.4
及之前的版本中,每个
mongos
会偶尔扮演“均衡器”的角色。
均衡器是配置服务器副本集主节点上的后台进程,它会监视每个分片上的块数量。只有当
一个分片的块数量达到特定迁移阈值时,均衡器才会被激活。
MongoDB 3.4
以上的版本中,可以并发执行的迁移数量增加到了每个分片
一个迁移,并发迁移的最大数量是分片总数的一半。而在早期版本中,只支
持全局进行一个并发迁移。
假设一些集合已经达到了阈值,则均衡器会开始对块进行迁移。它会从负载较大的分片中
选择一个块,并询问该分片是否应该在迁移之前对块进行拆分。在完成必要的拆分后,就
会将块迁移到具有较少块的机器上。
使用集群的应用程序不需要感知数据的迁移:所有读写请求都会被路由到旧的块上,直到
迁移完成。一旦元数据被更新,任何试图访问旧位置数据的
mongos
进程都会收到一个错
误。这个错误对客户端是不可见的:
mongos
会默默地处理这个错误并在新的分片上重试
此操作。
有时可能会在
mongos
日志中看到
unable to
setShardVersion
”的信息,这是一个常见的
错误。当
mongos
收到这种类型的错
误时,它会从配置服务器查找数据的新位置,并更新
块分布表,然后重新执行之前的请求。如果成功从新位置检索到数据,则会将数据返回给 ...
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