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版)
290
17
如果有多个
mongos
进程,则可能会创建超出分片处理能力的连接:默认情况下,一个
mongos
可以接受
65 536
个连接
(与
mongod
一样),因此如果有
5
mongos
进程,每个
10 000
个客户端连接,那么这些
mongos
可能会试图创建
50 000
个到分片的连接!
为了防止这种情况发生,可以在
mongos
的命令行配置中使用
--maxConns
选项来限制其可
以创建的连接数。一个分片可以处理的单个
mongos
的最大连接数可以用以下公式来计算。
maxConns = maxConnsPrimary
(numMembersPerReplicaSet
×
3)
(other
×
3) / numMongosProcesses
以下是公式的各个部分。
maxConnsPrimary
主节点上的最大连接数,通常设置为
20 000
,以避免来自
mongos
的连接冲垮分片。
(numMembersPerReplicaSet
×
3)
主节点会与每个从节点创建一个连接,而每个从节点会与主节点创建两个连接,所以总
共有
3
个连接。
(other
×
3)
这里的其他是指可能连接到
mongods
的各种进程的数量,
比如监视或备份的代理、
shell
的直接连接(用于管理),或者为了迁移而连接到其他分片的连接。
numMongosProcesses
分片集群中
mongos
的总数。
注意,
maxConns
只会阻止
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