SlideShare uma empresa Scribd logo
1 de 16
Practical Replication Chris Westin Software Engineer, 10gen © Copyright 2010 10gen Inc.
What is Replication for? High availability If a node fails, another node can step in Extra copies of data for recovery Scaling reads Applications with high read rates can read from replicas
What Does Replication Look Like? Replica Set A set of mongod servers Minimum of 3 Can use “arbiters” Consensus election of a “primary” All writes go to primary “Secondaries” replicate from primary
Configuring a Replica Set Start mongod processes with --replSet <name> Then:
Managing a Replica Set --oplogSize <MB> mongod option:  choose size of replication log --fastsync mongod option:  skip full resync of new secondary that was created from a recent copy rs.add(“hostname:<port>”) Shell helper:  add a new member rs.remove(“hostname:<port>”) Shell helper:  remove a member
Some Administrative Commands replSetGetStatus Reports status of the replica set from one node’s point of view replSetStepDown Request the primary to step down replSetFreeze Prevents any changes to the current replica set configuration (primary/secondary status) Use during backups
How Does it Work? Change operations are written to the oplog The oplog is a capped collection Must have enough space to allow new secondaries to catch up after copying from a primary Must have enough space to cope with any applicable slaveDelay Secondaries query the primary’s oplog and apply what they find
Failover Replica set members monitor each other via heartbeats If the primary can’t be reached, a new one is elected The secondary with the most up-to-date oplog is chosen If, after election, a secondary has changes not on the new primary, those are undone, and moved aside (changes saved to a BSON file) If you require a guarantee, ensure data is written to a majority of the replica set
Priority Optional parameter to replica set member configuration All other things being equal, the highest priority member wins the election for primary Changes in secondaries’ relative lag, i.e., catching up to primary, can trigger an election Zero priority:  can never become primary Use for remote DR, delayed slaves, backups, analytics sources
For Applications getLastError( { w : … } ) Application waits until changes are written to the specified number of servers Defaults can be set in the replica set’s configuration “Safe mode” for critical writes:  setWriteConcern() Another way to force writes to a number of servers Drivers support “slaveOk” for sending queries to a secondary This is for scaling reads
Replication and Sharding Each shard needs its own replica set Drivers use a mongos process to route queries to the appropriate shard(s) Configuration servers maintain the shard key range metadata
Replication and Sharding
Data Center Awareness Tag nodes in replica set configuration Apply hierarchical labels to replica set members Define getLastError modes Require number of nodes writes must go to Require locations of nodes writes must go to Combinations Available in 1.9.1
Tagging Example
Documentation http://www.mongodb.org/display/DOCS/Replica+Sets Index of documents on replication topics
Practical Replication June-2011

Mais conteúdo relacionado

Mais procurados

Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/A
Abdul Munam
 
Google File System
Google File SystemGoogle File System
Google File System
nadikari123
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
Sudheer Kondla
 
X64 Workshop Linux Information Gathering
X64 Workshop Linux Information GatheringX64 Workshop Linux Information Gathering
X64 Workshop Linux Information Gathering
Aero Plane
 
Using MMS to Build New Environments
Using MMS to Build New EnvironmentsUsing MMS to Build New Environments
Using MMS to Build New Environments
MongoDB
 
Google file system
Google file systemGoogle file system
Google file system
Dhan V Sagar
 

Mais procurados (20)

Google File System
Google File SystemGoogle File System
Google File System
 
Sql Server Best Practices
Sql Server Best PracticesSql Server Best Practices
Sql Server Best Practices
 
C# and Borland StarTeam Connectivity
C# and Borland StarTeam ConnectivityC# and Borland StarTeam Connectivity
C# and Borland StarTeam Connectivity
 
Advance google file system
Advance google file systemAdvance google file system
Advance google file system
 
Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/A
 
GFS
GFSGFS
GFS
 
Google File System
Google File SystemGoogle File System
Google File System
 
Google file system GFS
Google file system GFSGoogle file system GFS
Google file system GFS
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
 
Google file system
Google file systemGoogle file system
Google file system
 
Gfs
GfsGfs
Gfs
 
GOOGLE FILE SYSTEM
GOOGLE FILE SYSTEMGOOGLE FILE SYSTEM
GOOGLE FILE SYSTEM
 
X64 Workshop Linux Information Gathering
X64 Workshop Linux Information GatheringX64 Workshop Linux Information Gathering
X64 Workshop Linux Information Gathering
 
google file system
google file systemgoogle file system
google file system
 
Using MMS to Build New Environments
Using MMS to Build New EnvironmentsUsing MMS to Build New Environments
Using MMS to Build New Environments
 
Google file system
Google file systemGoogle file system
Google file system
 
Tempesta FW - Framework и Firewall для WAF и DDoS mitigation, Александр Крижа...
Tempesta FW - Framework и Firewall для WAF и DDoS mitigation, Александр Крижа...Tempesta FW - Framework и Firewall для WAF и DDoS mitigation, Александр Крижа...
Tempesta FW - Framework и Firewall для WAF и DDoS mitigation, Александр Крижа...
 
Stabilising the jenga tower
Stabilising the jenga towerStabilising the jenga tower
Stabilising the jenga tower
 
High Availabiltity & Replica Sets with mongoDB
High Availabiltity & Replica Sets with mongoDBHigh Availabiltity & Replica Sets with mongoDB
High Availabiltity & Replica Sets with mongoDB
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 

Destaque

Destaque (8)

Fundamentals of Managing the Data Center Life Cycle for Owners
Fundamentals of Managing the Data Center Life Cycle for OwnersFundamentals of Managing the Data Center Life Cycle for Owners
Fundamentals of Managing the Data Center Life Cycle for Owners
 
Architecting a Scale Out Cloud Storage Solution
Architecting a Scale Out Cloud Storage SolutionArchitecting a Scale Out Cloud Storage Solution
Architecting a Scale Out Cloud Storage Solution
 
Stingray - Riverbed Technology
Stingray - Riverbed TechnologyStingray - Riverbed Technology
Stingray - Riverbed Technology
 
MongoDB: An Introduction - July 2011
MongoDB:  An Introduction - July 2011MongoDB:  An Introduction - July 2011
MongoDB: An Introduction - July 2011
 
Gripshort
GripshortGripshort
Gripshort
 
Ambari hadoop-ops-meetup-2013-09-19.final
Ambari hadoop-ops-meetup-2013-09-19.finalAmbari hadoop-ops-meetup-2013-09-19.final
Ambari hadoop-ops-meetup-2013-09-19.final
 
cfengine3 at #lspe
cfengine3 at #lspecfengine3 at #lspe
cfengine3 at #lspe
 
Data Center Program Integrated Commissioning Program Baseline
Data Center Program Integrated Commissioning Program BaselineData Center Program Integrated Commissioning Program Baseline
Data Center Program Integrated Commissioning Program Baseline
 

Semelhante a Practical Replication June-2011

MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
Tharun Srinivasa
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
Jignesh Shah
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart Frog
Steve Loughran
 

Semelhante a Practical Replication June-2011 (20)

MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
 
Gg steps
Gg stepsGg steps
Gg steps
 
Mongodb connection string
Mongodb connection stringMongodb connection string
Mongodb connection string
 
Event Processing and Integration with IAS Data Processors
Event Processing and Integration with IAS Data ProcessorsEvent Processing and Integration with IAS Data Processors
Event Processing and Integration with IAS Data Processors
 
How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Zookeeper Introduce
Zookeeper IntroduceZookeeper Introduce
Zookeeper Introduce
 
Introduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System AdministratorsIntroduction to PostgreSQL for System Administrators
Introduction to PostgreSQL for System Administrators
 
60141457-Oracle-Golden-Gate-Presentation.ppt
60141457-Oracle-Golden-Gate-Presentation.ppt60141457-Oracle-Golden-Gate-Presentation.ppt
60141457-Oracle-Golden-Gate-Presentation.ppt
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
Cloud init and cloud provisioning [openstack summit vancouver]
Cloud init and cloud provisioning [openstack summit vancouver]Cloud init and cloud provisioning [openstack summit vancouver]
Cloud init and cloud provisioning [openstack summit vancouver]
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
 
Data replication
Data replicationData replication
Data replication
 
Talon systems - Distributed multi master replication strategy
Talon systems - Distributed multi master replication strategyTalon systems - Distributed multi master replication strategy
Talon systems - Distributed multi master replication strategy
 
Securing Your Enterprise Web Apps with MongoDB Enterprise
Securing Your Enterprise Web Apps with MongoDB Enterprise Securing Your Enterprise Web Apps with MongoDB Enterprise
Securing Your Enterprise Web Apps with MongoDB Enterprise
 
W5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.pptW5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.ppt
 
Taming Deployment With Smart Frog
Taming Deployment With Smart FrogTaming Deployment With Smart Frog
Taming Deployment With Smart Frog
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 

Mais de Chris Westin

Mysql proxy presentation_yahoo
Mysql proxy presentation_yahooMysql proxy presentation_yahoo
Mysql proxy presentation_yahoo
Chris Westin
 

Mais de Chris Westin (17)

Data torrent meetup-productioneng
Data torrent meetup-productionengData torrent meetup-productioneng
Data torrent meetup-productioneng
 
Cluster management and automation with cloudera manager
Cluster management and automation with cloudera managerCluster management and automation with cloudera manager
Cluster management and automation with cloudera manager
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
SDN/OpenFlow #lspe
SDN/OpenFlow #lspeSDN/OpenFlow #lspe
SDN/OpenFlow #lspe
 
mongodb-aggregation-may-2012
mongodb-aggregation-may-2012mongodb-aggregation-may-2012
mongodb-aggregation-may-2012
 
Nimbula lspe-2012-04-19
Nimbula lspe-2012-04-19Nimbula lspe-2012-04-19
Nimbula lspe-2012-04-19
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012
 
MongoDB's New Aggregation framework
MongoDB's New Aggregation frameworkMongoDB's New Aggregation framework
MongoDB's New Aggregation framework
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
 
FlashCache
FlashCacheFlashCache
FlashCache
 
Large Scale Cacti
Large Scale CactiLarge Scale Cacti
Large Scale Cacti
 
MongoDB: An Introduction - june-2011
MongoDB:  An Introduction - june-2011MongoDB:  An Introduction - june-2011
MongoDB: An Introduction - june-2011
 
Ganglia Overview-v2
Ganglia Overview-v2Ganglia Overview-v2
Ganglia Overview-v2
 
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
 
Mysql Proxy Presentation Yahoo
Mysql Proxy Presentation YahooMysql Proxy Presentation Yahoo
Mysql Proxy Presentation Yahoo
 
Mysql proxy presentation_yahoo
Mysql proxy presentation_yahooMysql proxy presentation_yahoo
Mysql proxy presentation_yahoo
 
CI in the Enterprise: Lessons Learned
CI in the Enterprise:  Lessons LearnedCI in the Enterprise:  Lessons Learned
CI in the Enterprise: Lessons Learned
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Practical Replication June-2011

  • 1. Practical Replication Chris Westin Software Engineer, 10gen © Copyright 2010 10gen Inc.
  • 2. What is Replication for? High availability If a node fails, another node can step in Extra copies of data for recovery Scaling reads Applications with high read rates can read from replicas
  • 3. What Does Replication Look Like? Replica Set A set of mongod servers Minimum of 3 Can use “arbiters” Consensus election of a “primary” All writes go to primary “Secondaries” replicate from primary
  • 4. Configuring a Replica Set Start mongod processes with --replSet <name> Then:
  • 5. Managing a Replica Set --oplogSize <MB> mongod option: choose size of replication log --fastsync mongod option: skip full resync of new secondary that was created from a recent copy rs.add(“hostname:<port>”) Shell helper: add a new member rs.remove(“hostname:<port>”) Shell helper: remove a member
  • 6. Some Administrative Commands replSetGetStatus Reports status of the replica set from one node’s point of view replSetStepDown Request the primary to step down replSetFreeze Prevents any changes to the current replica set configuration (primary/secondary status) Use during backups
  • 7. How Does it Work? Change operations are written to the oplog The oplog is a capped collection Must have enough space to allow new secondaries to catch up after copying from a primary Must have enough space to cope with any applicable slaveDelay Secondaries query the primary’s oplog and apply what they find
  • 8. Failover Replica set members monitor each other via heartbeats If the primary can’t be reached, a new one is elected The secondary with the most up-to-date oplog is chosen If, after election, a secondary has changes not on the new primary, those are undone, and moved aside (changes saved to a BSON file) If you require a guarantee, ensure data is written to a majority of the replica set
  • 9. Priority Optional parameter to replica set member configuration All other things being equal, the highest priority member wins the election for primary Changes in secondaries’ relative lag, i.e., catching up to primary, can trigger an election Zero priority: can never become primary Use for remote DR, delayed slaves, backups, analytics sources
  • 10. For Applications getLastError( { w : … } ) Application waits until changes are written to the specified number of servers Defaults can be set in the replica set’s configuration “Safe mode” for critical writes: setWriteConcern() Another way to force writes to a number of servers Drivers support “slaveOk” for sending queries to a secondary This is for scaling reads
  • 11. Replication and Sharding Each shard needs its own replica set Drivers use a mongos process to route queries to the appropriate shard(s) Configuration servers maintain the shard key range metadata
  • 13. Data Center Awareness Tag nodes in replica set configuration Apply hierarchical labels to replica set members Define getLastError modes Require number of nodes writes must go to Require locations of nodes writes must go to Combinations Available in 1.9.1