Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MongoDB Basic
Search
yuanxin.qiu
August 28, 2013
Technology
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MongoDB Basic
Rails Night 分享文件,
http://floating-brook-3473.herokuapp.com/activities/14
yuanxin.qiu
August 28, 2013
More Decks by yuanxin.qiu
See All by yuanxin.qiu
MongoDB Basic
star
0
82
Other Decks in Technology
See All in Technology
AI Made Us Faster at Solving the Wrong Problems
marceloancelmo
0
140
OpenClawでAzure DevOpsのWiki更新を自動化する - クラウドAIだけでは届かない場所へ
yutakaosada
0
140
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
710
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
360
AI駆動開発で仕様はどこまで書くべきか? ― 人とAIの責務境界から考える開発プロセスの実践
takahiromatsui
1
300
Account Factory for Terraformによる 標準化されたアカウント発行の自動化
pensuke628
0
120
Amazon Bedrock Agents ClassicからAmazon Bedrock AgentCoreへ移行した際、ガードレール設定が2箇所に割れた話
matsunobu
0
170
インバスケット試験対策アプリを 作って見えたAIエージェント構築 ナレッジ2選
shichijoyuhi
1
110
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
320
LLM機能を自作して分かるSnowflake Cortex AIの強み
nayuts
0
190
Argo CDとAtlantisで実現するインフラ管理のセルフサービス化──小規模SREチームで支えるプラットフォーム
cassius7
0
270
Claude起点の仕様駆動開発
tanakaseiya
0
290
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
380
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
We Have a Design System, Now What?
morganepeng
55
8.3k
Designing for humans not robots
tammielis
254
26k
HDC tutorial
michielstock
2
930
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Marketing to machines
jonoalderson
1
5.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Transcript
MongoDB
_id ObjectId 是 “_id”的默认类型,ObjectId使用12字节的存储空间,每个字 节两位十六进制数,是一个24位的字符串。
One to Many
Many to Many
Master to Slave 主数据库 从数据库 从数据库 备份、故障恢复、读扩展
Replica Sets server-1 server-3 server-2 副本集模式:具有Master-‐Slave模式 所有特点,但是副本集没有固定的主 服务器,当初始化的时候会通过多个
服务器投票选举出一个主服务器。 当主服务器故障时会再次通过投票 选举出新的主服务器,而原先的主服 务器恢复后则转为从服务器。 Replica Sets的在故障发生时自动切换 的机制可以及时保证写入操作.
Replica Sets 各个 Primary 与 Secondary 之 间一直保持心跳同步检测,
用于判断 Replica Sets 的状态
两种模式 hAp://database.51cto.com/art/201107/278632_1.htm
Sharding Products (Shard) Product s Product s Product s Product
s Product s Product s
Sharding l shard key l 一分片多区间 l 数据均衡器
Balancer l MMAP内存映射
Sharding Config Shard-‐1 Shard-‐2 Mongos . . .
Sharding 要构建一个MongoDB Sharding Cluster,需要三种角色: 1、Sharding Server mongod实例,用于存储实际的数据块
2、Config Server mongod实例,存储了整个Cluster Metadata,其中包括chunk信息,确保元数 据完整性 3、Route Server mongos实例,前端路由,客户端由此接入,且让整个集群看上去像单一进程数据 库,多个mongos可实现负载平衡,提高客户端的接入性能
分片机制
分片机制 l MongoDB 的分片是指定一个分片 key 来进行,数据按范围分成不同 的 chunk,每个 chunk 的大小有限制
l 有多个分片节点保存这些chunk,每个节点保存一部分的 chunk l 当一个chunk超过其限制的最大体积时,会分裂成两个小的chunk l 当chunk在分片节点中分布不均衡时,会引发 chunk 迁移操作
Replica Sets + Sharding
备份与恢复 l mongodump –d db_name -‐o backup l mongorestore
–d db_name –drop backup/db_name fsync 锁来保证数据同步