Skip to content

Instantly share code, notes, and snippets.

@desmondmorris
Last active December 18, 2015 19:19
Show Gist options
  • Save desmondmorris/5832414 to your computer and use it in GitHub Desktop.
Save desmondmorris/5832414 to your computer and use it in GitHub Desktop.
MongoDB NYC 2013 - Replica Sets

REPLICA SETS

HIDDEN - Reporting, Backup with out affecting the actual dataset

ROLES

Arbiter - low resource, voting member

// Highest priority always wins conf = { _id: "mySet", members: [ {_id: 0, host: "A", priority: 3, tags: {"datacenter": "NY"}}, {_id: 1, host: "B", priority: 2}, {_id: 2, host: "C"} // Defaults to priority 1 {_id: 3, host: "D", hidden: true} // Analytics node {_id: 4, host: "E", hidden: true, slaveDelay: 3600} // Backup node. One hour delay. THIS IS AWESOME ] }

App developers

  1. Consistency - RW to primary
  2. Delayed Consistency - W to primary, R from secondary

** Write Concern **

  • Network acknowledment
  • Wait for error
  • Wait for journal sync - Wait till it is written to disk
  • Wait for replication

** Read Preference **

  • primary - immediate
  • primaryPreferred
  • secondary
  • secondaryPreferred
  • Nearest - nearest in ping (latency)

Operational Considerations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment