Your SlideShare is downloading. ×
Mongosv 2011 - Replication
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Mongosv 2011 - Replication

1,025
views

Published on

Replication talk from MongoSV 2011

Replication talk from MongoSV 2011

Published in: Technology, Education

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,025
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ReplicationJared Rosoff (@forjared)
  • 2. Overview• Intro to replica sets• The oplog• Durability and Consistency• Common deployment scenarios• Advanced configuration
  • 3. INTRO TO REPLICA SETS
  • 4. Replica Sets Write Primary Read AsynchronousDriver Secondary Replication Read Secondary Read
  • 5. Replica Sets PrimaryDriver Secondary Read Secondary Read
  • 6. Replica Sets Primary Write AutomaticDriver Primary Leader Election Read Secondary Read
  • 7. Replica Sets Secondary Read WriteDriver Primary Read Secondary Read
  • 8. CONSISTENCY ANDDURABILITY
  • 9. Strong Consistency WriteDriver Primary Read Secondary Secondary
  • 10. Eventual Consistency Write PrimaryDriver Secondary Read Secondary Read
  • 11. Durability• Fire and forget• Wait for error• Wait for fsync• Wait for journal sync• Wait for replication
  • 12. Fire and forgetDriver Primary write apply in memory
  • 13. Get last errorDriver Primary write getLastError apply in memory
  • 14. Wait for Journal SyncDriver Primary write getLastError apply in memory j:true Write to journal
  • 15. Wait for fsyncDriver Primary write getLastError apply in memory fsync:true fsync
  • 16. Wait for replicationDriver Primary Secondary write getLastError apply in memory w:2 replicate
  • 17. Write Concern OptionsValue Meaning<n:integer> Replicate to N members of replica set“majority” Replicate to a majority of replica set members<m:modeName> Use custom error mode name
  • 18. Tagging { _id: “someSet”, 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: {These are the getLastErrorModes: {modes you can veryImportant: { dc: 3 }, use in write sortOfImportant: { dc: 2 } concern } } }
  • 19. REPLICA SET OPTIONS
  • 20. Priorities• Between 0..1000• Highest member that is up to date wins – Up to date == within 10 seconds of primary• If a higher priority member catches up, it will force election and win Primary Secondary Secondary priority = 100 priority = 50 priority = 20
  • 21. Slave Delay• Lags behind master by configurable time delay• Automatically hidden from clients• Protects against operator errors – Accidentally delete database – Application corrupts data
  • 22. Arbiters• Vote in elections• Don’t store a copy of data• Use as tie breaker
  • 23. COMMON DEPLOYMENTSCENARIOS
  • 24. Typical Data CenterPrimary Secondary Secondary
  • 25. Backup Node Data CenterPrimary Secondary Secondary hidden = true backups
  • 26. Disaster Recovery Active Data Center Standby Data CenterPrimary Secondary Secondarypriority = 1 priority = 1
  • 27. Multi Data CenterWest Coast DC Central DC East Coast DCSecondary Primary Secondary priority = 1