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 Replication
Search
Sridhar Nanjundeswaran
September 14, 2012
Programming
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MongoDB Replication
Presented at MongoDB Seattle Sept 2012.
Sridhar Nanjundeswaran
September 14, 2012
More Decks by Sridhar Nanjundeswaran
See All by Sridhar Nanjundeswaran
MongoDB Introduction
sridharnanjundeswaran
2
150
Built to scale – Cloud Computing and NoSQL databases
sridharnanjundeswaran
0
81
Replication and Replica Sets
sridharnanjundeswaran
1
130
MongoDB Roadmap
sridharnanjundeswaran
1
140
MongoDB Replication and Replica Sets
sridharnanjundeswaran
1
64
MongoDB Roadmap
sridharnanjundeswaran
1
59
Building your first MongoDB app
sridharnanjundeswaran
0
79
MongoDB and Windows Azure
sridharnanjundeswaran
0
81
MongoDB 2.2 New Features
sridharnanjundeswaran
2
220
Other Decks in Programming
See All in Programming
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
32
14k
Verilogで学ぶCPU自作入門.pdf
uyuki234
7
3.9k
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
250
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
180
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
160
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
330
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
250
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
110
速習iPhone Duo対応
yuukiw00w
2
920
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.7k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
460
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Building Adaptive Systems
keathley
44
3.2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
440
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Google's AI Overviews - The New Search
badams
0
1.6k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
700
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
Navigating Weather and Climate Data
rabernat
0
540
Transcript
1 Sridhar Nanjundeswaran, 10gen
[email protected]
@snanjund
2 • Introduction to Replica Sets • Developing with Replica
Sets • Operational Considerations • Miscellaneous
Introduction to Replica Sets What is it? Configuration Options
4 Node 1 Node 2 Node 3
5 Node 1 Secondary Node 2 Secondary Node 3 Primary
Replication Replication Heartbeat
6 Node 1 Secondary Node 2 Secondary Node 3 Primary
Heartbeat Primary Election
7 Node 1 Secondary Node 2 Primary Node 3 Primary
Heartbeat Replication
8 Node 1 Secondary Node 2 Primary Node 3 Secondary
Replication Heartbeat Replication
9 • Priorities – Help control election – Secondary only
• Slave Delay – Purposely delay replication • Hidden – Not seen as part client connection • Tagging
10 • New in 2.0.0 • Control over where data
is written to • Each member can have one or more tags e.g. • tags: {dc: "ny"} • tags: {dc: "ny", ip: "192.168", rack: "row3rk7"} • Replica set defines rules for where data resides • Rules can change without changing app code
11 { _id : "mySet", members : [ {_id :
0, host : "A", tags : {"dc": "ny"}}, {_id : 1, host : "B", tags : {"dc": "ny"}}, {_id : 2, host : "C", tags : {"dc": "sf"}}, {_id : 3, host : "D", tags : {"dc": "sf"}}, {_id : 4, host : "E", tags : {"dc": "cloud"}}] settings : { getLastErrorModes : { allDCs : {"dc" : 3}, someDCs : {"dc" : 2}} } } > db.blogs.insert({...}) > db.runCommand({getLastError : 1, w : "allDCs"})
Developing with Replica Sets Consistency Write Preference Read Preference
13 Primary Secondary Secondary Read Write Driver Client
14 Primary Read Write Driver Read Secondary Secondary Client Application
15 • Fire and forget • Wait for error •
Wait for journal sync • Wait for replication
16 Driver Primary write apply in memory
17 Driver Primary getLastError apply in memory
18 Driver Primary getLastError apply in memory write j:true Write
to journal
19 Driver Primary getLastError apply in memory write w:2 Secondary
replicate
20 • 5 modes – primary (only) - Default –
primaryPreferred – secondary – secondaryPreferred – nearest
21 • Custom read preferences • Control where you read
from – E.g. { "disk": "ssd", "use": "reporting" } • Use in conjunction with standard read preferences – Except primary
Operational Considerations Upgrade/Maintenance Common Deployment Scenarios
23 • No downtime • Rolling upgrade/maintenance – Start with
Secondary – Primary last
24 • Single datacenter • Single switch & power •
Points of failure: – Power – Network – Datacenter – Two node failure • Automatic recovery of single node crash Member 1 Member 2 Member 3
25 • Multi datacenter • DR node for safety •
Can’t do multi data center durable write safely since only 1 node in distant DC Member 1 Member 2 Member 3 DC 1 DC 2
26 • Three data centers • Can survive full data
center loss • Can do w= { dc : 2 } to guarantee write in 2 data centers (with tags) Member 1 Member 2 Member 3 Member 4 DC 2 Member 5 - DR DC 1 DC 3
Miscellaneous Behind the scenes What’s new in 2.2
28 • Local DB • Oplog – Capped collection –
Idempotent version of operation stored db.replsettest.update({},{$inc:{set:1}}) { "ts" : …, "h" : …, "op" : "u", "ns" : "mongo_la.replsettest", "o2" : { "_id" : ObjectId("4f177bc768dad821278224d8") }, "o" : { "$set" : { "set" : 2 } } }
29 • Full read preference support in mongos – Drivers
too • Improved RS lag logging • rs.syncFrom command • buildIndexes setting • replIndexPrefetch setting
30 • Use replica sets • Easy to setup even
on a single machine • Check doc page for RS tutorials – http://docs.mongodb.org/manual/replication/#t utorials
31 @mongodb © Copyright 2010 10gen Inc. conferences, appearances, and
meetups http://www.10gen.com/events http://bit.ly/mongofb Facebook | Twitter | LinkedIn http://linkd.in/joinmongo download at mongodb.org We’re Hiring !
[email protected]
@snanjund