Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Replication and replica sets

Libros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo

Audiolibros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Replication and replica sets

  1. 1. Internal Tools, 10genJ. Randall Hunt#MongoDBDaysIntroduction to Replicationand Replica Sets
  2. 2. Agenda• Replica Sets Lifecycle• Developing with Replica Sets• Operational Considerations
  3. 3. Why Replication?• How many have faced node failures?• How many have been woken up from sleep todo a fail-over(s)?• How many have experienced issues due tonetwork latency?• Different uses for data– Normal processing– Simple analytics
  4. 4. Replica Set Lifecycle
  5. 5. Replica Set – Creation
  6. 6. Replica Set – Initialize
  7. 7. Replica Set – Failure
  8. 8. Replica Set – Failover
  9. 9. Replica Set – Recovery
  10. 10. Replica Set – Recovered
  11. 11. Replica Set Roles &Configuration
  12. 12. Replica Set Roles
  13. 13. > conf = {_id : "mySet",members : [{_id : 0, host : "A”, priority : 3},{_id : 1, host : "B", priority : 2},{_id : 2, host : "C”},{_id : 3, host : "D", hidden : true},{_id : 4, host : "E", hidden : true, slaveDelay : 3600}]}> rs.initiate(conf)Configuration Options
  14. 14. > conf = {_id : "mySet”,members : [{_id : 0, host : "A”, priority : 3},{_id : 1, host : "B", priority : 2},{_id : 2, host : "C”},{_id : 3, host : "D", hidden : true},{_id : 4, host : "E", hidden : true, slaveDelay : 3600}]}> rs.initiate(conf)Configuration OptionsPrimary DC
  15. 15. > conf = {_id : "mySet”,members : [{_id : 0, host : "A”, priority : 3},{_id : 1, host : "B", priority : 2},{_id : 2, host : "C”},{_id : 3, host : "D", hidden : true},{_id : 4, host : "E", hidden : true, slaveDelay : 3600}]}> rs.initiate(conf)Configuration OptionsSecondary DCDefault Priority = 1
  16. 16. > conf = {_id : "mySet”,members : [{_id : 0, host : "A”, priority : 3},{_id : 1, host : "B", priority : 2},{_id : 2, host : "C”},{_id : 3, host : "D", hidden : true},{_id : 4, host : "E", hidden : true, slaveDelay : 3600}]}> rs.initiate(conf)Configuration OptionsAnalyticsnode
  17. 17. > conf = {_id : "mySet”,members : [{_id : 0, host : "A”, priority : 3},{_id : 1, host : "B", priority : 2},{_id : 2, host : "C”},{_id : 3, host : "D", hidden : true},{_id : 4, host : "E", hidden : true, slaveDelay : 3600}]}> rs.initiate(conf)Configuration OptionsBackup node
  18. 18. Developing with ReplicaSets
  19. 19. Strong Consistency
  20. 20. Delayed Consistency
  21. 21. Write Concern• Network acknowledgement• Wait for error• Wait for journal sync• Wait for replication
  22. 22. Unacknowledged
  23. 23. MongoDB Acknowledged (wait forerror)
  24. 24. Wait for Journal Sync
  25. 25. Wait for Replication
  26. 26. Tagging• Control where data is written to, and read from• Each member can have one or more tags– tags: {dc: "ny"}– tags: {dc: "ny",
 subnet: "192.168",
 rack:"row3rk7"}• Replica set defines rules for write concerns• Rules can change without changing app code
  27. 27. {_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 : "someDCs"})Tagging Example
  28. 28. Wait for Replication (Tagging)
  29. 29. Read Preference Modes• 5 modes– primary (only) - Default– primaryPreferred– secondary– secondaryPreferred– NearestWhen more than one node is possible, closest node is usedfor reads (all modes but primary)
  30. 30. OperationalConsiderations
  31. 31. Maintenance and Upgrade• No downtime• Rolling upgrade/maintenance– Start with Secondary– Primary last
  32. 32. Replica Set – 1 Data Center• Single datacenter• Single switch & power• Points of failure:– Power– Network– Data center– Two node failure• Automatic recovery ofsingle node crash
  33. 33. Replica Set – 2 Data Centers• Multi data center• DR node for safety• Can’t do multi datacenter durable writesafely since only 1node in distant DC
  34. 34. Replica Set – 3 Data Centers• Three data centers• Can survive full datacenter loss• Can do w= { dc : 2 } toguarantee write in 2data centers (with tags)
  35. 35. Recent improvements• Read preference support with sharding– Drivers too• Improved replication over WAN/high-latencynetworks• rs.syncFrom command• buildIndexes setting• replIndexPrefetch setting
  36. 36. Just Use It• Use replica sets• Easy to setup– Try on a single machine• Check doc page for RS tutorials– http://docs.mongodb.org/manual/replication/#tutorials
  37. 37. Internal Tools, 10genJ. Randall Hunt#MongoDBDaysThank You
  38. 38. Next Sessions at 12:405th Floor:West Side Ballroom 3&4: Indexing and Query OptimizationWest Side Ballroom 1&2: Text Search (Beta)Juilliard Complex: Business Track: Building a Personalized MobileApp Experience Using MongoDB atADPLyceum Complex:Ask the Experts7th Floor:Empire Complex: Scaling MongoDB; Sharding Into and Beyond theMulti-Terabyte RangeSoHo Complex:Automated Slow QueryAnalysis: MongoDB &Hadoop, Sittin in a Tree

    Sé el primero en comentar

    Inicia sesión para ver los comentarios

Vistas

Total de vistas

548

En Slideshare

0

De embebidos

0

Número de embebidos

1

Acciones

Descargas

7

Compartidos

0

Comentarios

0

Me gusta

0

×