SlideShare a Scribd company logo
Exploring the replication in
MongoDB
Date: Oct-4-2016
About us
Lead Database Consultant @Pythian
OSDB managed services since 2014
https://mk.linkedin.com/in/igorle
@igorLE
Database Consultant @Pythian
OSDB managed services since 2014
https://tr.linkedin.com/in/okanbuyukyilmaz
Overview
• Why Replication, replication definition
• How replication works, replication concepts
• Replica set features, deployment architectures
• Replica set configuration options
• Key metrics to monitor when running replica set
• MySQL replication compared to MongoDB replication
• Galera replication compared to MongoDB replication
Definition
• Group of mongod processes that maintain the same
data set
• Redundancy and high availability
• Increased read capacity
Replication concept
• Write operations go to the Primary node
• All changes are recorded into operations log - oplog
• Asynchronous replication
• Secondaries replicate the Primary oplog
• Secondary can use sync source other Secondary
• One Arbiter node per replica set
• Automatic failover. Any node can become Primary
Replication concept
Replica set oplog
• Special capped collection that keeps a rolling record of
all operations that modify the data stored in the
databases
• Idempotent
• Default oplog size
For Unix and Windows systems
Storage Engine Default Oplog Size Lower Bound Upper Bound
In-memory 5% of physical memory 50MB 50GB
WiredTiger 5% of free disk space 990MB 50GB
MMAPv1 5% of free disk space 990MB 50GB
Replica set oplog
● Workloads that might require larger oplog size
○ updates to multiple documents at once
○ Deletions equal the same amount of data as inserts
○ Significant number of in-place updates
● Oplog status
○ rs.printReplicationInfo() - on a Secondary node
○ rs.printSlaveReplicationInfo() - on a Primary node
○ db.getReplicationInfo() - by using the local database
Deployment
MongoDB configuration file: /etc/mongod.conf
Before MongoDB 3.0
replSet=MyRepl
oplogSize=4096MB
YAML format since 3.0
replication:
replSetName: MyRepl
oplogSizeMB: 4096
Deployment
• 3 node replica set
Node1
Node2 Node3
Deployment
Node1
/usr/bin/mongod -f mongod.conf
> rs.initialize()
Node2 Node3
Primary
Deployment
• rs.add()
• rs.add(“node2:27017”)
Node3
Deployment
• rs.add()
• rs.add(“node3:27017”)
Replica set maintenance
• rs.status()
• rs.conf()
• rs.reconfig()
• rs.remove()
• rs.stepDown()
• rs.freeze()
• rs.isMaster()
• rs.syncFrom()
• rs.printReplicationInfo()
• rs.printSlaveReplicationInfo()
Configuration options
• 50 members per replica set (7 voting members)
• Arbiter node
• Hidden node
• Priority 0 node
• Delayed node
• Build indexes
• Fault tolerance
• Write concern
• Read preference
Configuration options
rsTest:PRIMARY> rs.conf()
{ "_id" : "rsTest",
"version" : 2,
"members" : [
{
"_id" : 0,
"host" : "node1:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {"dc" : "apac"},
"slaveDelay" : 0,
"votes" : 1
},
Arbiter node
• Votes in elections
• Does not hold copy of data
{
"_id" : <num>
"host" : <hostname:port>,
"arbiterOnly" : true,
….
}
hidden : true
Hidden node
• Never becomes primary
• Not visible to application
• Use cases
○ reporting
○ backups
{
"_id" : <num>
"host" : <hostname:port>,
"priority" : 0,
"hidden" : true
}
hidden : true
Priority 0 node
Priority - floating point (i.e. decimal) number between 0 and 1000
• Hidden members and Delayed slave with priority 0 by default
• Never becomes primary
• Visible to application
{
"_id" : <num>
"host" : <hostname:port>,
"priority" : 0
}
Delayed node
• must be priority 0 member
• should be hidden member (not mandatory)
• has votes 1 by default
• considerations (oplog size)
• mainly used for backups
{
"_id" : <num>,
"host" : <hostname:port>,
"priority" : 0,
"slaveDelay" : <seconds>,
"hidden" : true
}
Build indexes
members[n].buildIndexes : false
• Can be only set when adding a member to a replica set
• Can not be changed on running node
• Indexes on _id will still exist
• Priority must be set to 0, recommended as hidden:true
Useful when
• Node is used for backups using mongodump
• Node does not receive queries from clients
• Adding indexes and maintenance overburdens the host
system
Fault tolerance
Number of members Majority Required to Elect new Primary Fault Tolerance
3 2 1
4 3 1
5 3 2
6 4 2
7 4 3
Write concern
Write concern
Write concern specification
{ w: <value>, j: <boolean>, wtimeout: <number> }
• w - number
– Option for “majority”
• j - write operation has been written to the journal
• wtimeout - time limit, in milliseconds, for the write concern
Replica set get write concern setting
rsTest:PRIMARY> rs.conf().settings['getLastErrorDefaults']
{ "w" : 1, "wtimeout" : 0 }
Read preference
• primary
• primaryPreferred
• secondary
• secondaryPreferred
• nearest
Key metrics to monitor for RS
• Replica set has no Primary
• Number of healthy/unhealthy members
• Replication Oplog Window
• Replication lag
What is MySQL
Mysql is…
● Transactional
● Relational
● Well documented
● Open source
MySQL replication
Mysql Replication can be...
● Asynchronous
○ Built-in replication feature
○ Semi-synchronous by plugin rpl_semi_sync_master
● Synchronous
○ Galera setup with wsrep api
MySQL replication
• Group of mysqld processes that maintain the same data set
• Write operations go to the Master node, reads can go to
Slave
• All changes are recorded into binary log on the master
• Asynchronous replication, Semi-Synchronous replication
• Slave node replicates the events by copying binary logs as
relay logs
– IO Thread, SQL Thread
– Binary Logs format - Statement, Row, Mixed
• Expire logs days dynamic
• Replication filters
MySQL replication
MySQL Master
MySQL Process
Binary LogsMySQL Data
MySQL Slave
MySQL Process
SQL Thread
Relay logs
IO Thread MySQL Data
Questions?
We’re Hiring!
https://pythian.com

More Related Content

What's hot

Sharding
ShardingSharding
Sharding
MongoDB
 
MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals
Antonios Giannopoulos
 
Back to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentBack to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production Deployment
MongoDB
 
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB WorldNoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
Ajay Gupte
 
2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2MongoDB
 
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB
 
Basic Sharding in MongoDB presented by Shaun Verch
Basic Sharding in MongoDB presented by Shaun VerchBasic Sharding in MongoDB presented by Shaun Verch
Basic Sharding in MongoDB presented by Shaun VerchMongoDB
 
Back to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to ShardingBack to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to Sharding
MongoDB
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
MongoDB
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About Sharding
MongoDB
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo Seattle
MongoDB
 
Sharding
ShardingSharding
Sharding
MongoDB
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
Rick Copeland
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
MongoDB
 
Mongodb sharding
Mongodb shardingMongodb sharding
Mongodb sharding
xiangrong
 
Migrating to MongoDB: Best Practices
Migrating to MongoDB: Best PracticesMigrating to MongoDB: Best Practices
Migrating to MongoDB: Best Practices
MongoDB
 
Challenges with MongoDB
Challenges with MongoDBChallenges with MongoDB
Challenges with MongoDB
Stone Gao
 
MongoDB - External Authentication
MongoDB - External AuthenticationMongoDB - External Authentication
MongoDB - External Authentication
Jason Terpko
 
Webinar: Was ist neu in MongoDB 2.4
Webinar: Was ist neu in MongoDB 2.4Webinar: Was ist neu in MongoDB 2.4
Webinar: Was ist neu in MongoDB 2.4
MongoDB
 
MongoDB Roadmap
MongoDB RoadmapMongoDB Roadmap
MongoDB RoadmapMongoDB
 

What's hot (20)

Sharding
ShardingSharding
Sharding
 
MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals
 
Back to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentBack to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production Deployment
 
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB WorldNoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
NoSQL Analytics: JSON Data Analysis and Acceleration in MongoDB World
 
2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2
 
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
MongoDB San Francisco 2013: Basic Sharding in MongoDB presented by Brandon Bl...
 
Basic Sharding in MongoDB presented by Shaun Verch
Basic Sharding in MongoDB presented by Shaun VerchBasic Sharding in MongoDB presented by Shaun Verch
Basic Sharding in MongoDB presented by Shaun Verch
 
Back to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to ShardingBack to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to Sharding
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About Sharding
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo Seattle
 
Sharding
ShardingSharding
Sharding
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
 
Mongodb sharding
Mongodb shardingMongodb sharding
Mongodb sharding
 
Migrating to MongoDB: Best Practices
Migrating to MongoDB: Best PracticesMigrating to MongoDB: Best Practices
Migrating to MongoDB: Best Practices
 
Challenges with MongoDB
Challenges with MongoDBChallenges with MongoDB
Challenges with MongoDB
 
MongoDB - External Authentication
MongoDB - External AuthenticationMongoDB - External Authentication
MongoDB - External Authentication
 
Webinar: Was ist neu in MongoDB 2.4
Webinar: Was ist neu in MongoDB 2.4Webinar: Was ist neu in MongoDB 2.4
Webinar: Was ist neu in MongoDB 2.4
 
MongoDB Roadmap
MongoDB RoadmapMongoDB Roadmap
MongoDB Roadmap
 

Similar to Exploring the replication in MongoDB

Evolution Of MongoDB Replicaset
Evolution Of MongoDB ReplicasetEvolution Of MongoDB Replicaset
Evolution Of MongoDB Replicaset
M Malai
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
Mydbops
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
Chris Westin
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
Harun Yardımcı
 
Replication, Durability, and Disaster Recovery
Replication, Durability, and Disaster RecoveryReplication, Durability, and Disaster Recovery
Replication, Durability, and Disaster Recovery
Steven Francia
 
Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB MongoDB
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
Ryusuke Kajiyama
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment StrategyMongoDB
 
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
MongoDB
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
Nelson Calero
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
MongoDB
 
Back tobasicswebinar part6-rev.
Back tobasicswebinar part6-rev.Back tobasicswebinar part6-rev.
Back tobasicswebinar part6-rev.MongoDB
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
MongoDB
 
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Daniel Coupal
 
Monitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the WildMonitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the WildTim Vaillancourt
 
MongoDB at MapMyFitness from a DevOps Perspective
MongoDB at MapMyFitness from a DevOps PerspectiveMongoDB at MapMyFitness from a DevOps Perspective
MongoDB at MapMyFitness from a DevOps PerspectiveMongoDB
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment Strategies
MongoDB
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterChris Henry
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
Robert Friberg
 

Similar to Exploring the replication in MongoDB (20)

Evolution Of MongoDB Replicaset
Evolution Of MongoDB ReplicasetEvolution Of MongoDB Replicaset
Evolution Of MongoDB Replicaset
 
Evolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best PracticesEvolution of MongoDB Replicaset and Its Best Practices
Evolution of MongoDB Replicaset and Its Best Practices
 
Replication and replica sets
Replication and replica setsReplication and replica sets
Replication and replica sets
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
 
Replication, Durability, and Disaster Recovery
Replication, Durability, and Disaster RecoveryReplication, Durability, and Disaster Recovery
Replication, Durability, and Disaster Recovery
 
Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
 
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
 
Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)Deployment Strategies (Mongo Austin)
Deployment Strategies (Mongo Austin)
 
Back tobasicswebinar part6-rev.
Back tobasicswebinar part6-rev.Back tobasicswebinar part6-rev.
Back tobasicswebinar part6-rev.
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The SequelSilicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Monitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the WildMonitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the Wild
 
MongoDB at MapMyFitness from a DevOps Perspective
MongoDB at MapMyFitness from a DevOps PerspectiveMongoDB at MapMyFitness from a DevOps Perspective
MongoDB at MapMyFitness from a DevOps Perspective
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment Strategies
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb Cluster
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
 

Recently uploaded

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 

Recently uploaded (20)

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 

Exploring the replication in MongoDB

  • 1. Exploring the replication in MongoDB Date: Oct-4-2016
  • 2. About us Lead Database Consultant @Pythian OSDB managed services since 2014 https://mk.linkedin.com/in/igorle @igorLE Database Consultant @Pythian OSDB managed services since 2014 https://tr.linkedin.com/in/okanbuyukyilmaz
  • 3. Overview • Why Replication, replication definition • How replication works, replication concepts • Replica set features, deployment architectures • Replica set configuration options • Key metrics to monitor when running replica set • MySQL replication compared to MongoDB replication • Galera replication compared to MongoDB replication
  • 4. Definition • Group of mongod processes that maintain the same data set • Redundancy and high availability • Increased read capacity
  • 5. Replication concept • Write operations go to the Primary node • All changes are recorded into operations log - oplog • Asynchronous replication • Secondaries replicate the Primary oplog • Secondary can use sync source other Secondary • One Arbiter node per replica set • Automatic failover. Any node can become Primary
  • 7. Replica set oplog • Special capped collection that keeps a rolling record of all operations that modify the data stored in the databases • Idempotent • Default oplog size For Unix and Windows systems Storage Engine Default Oplog Size Lower Bound Upper Bound In-memory 5% of physical memory 50MB 50GB WiredTiger 5% of free disk space 990MB 50GB MMAPv1 5% of free disk space 990MB 50GB
  • 8. Replica set oplog ● Workloads that might require larger oplog size ○ updates to multiple documents at once ○ Deletions equal the same amount of data as inserts ○ Significant number of in-place updates ● Oplog status ○ rs.printReplicationInfo() - on a Secondary node ○ rs.printSlaveReplicationInfo() - on a Primary node ○ db.getReplicationInfo() - by using the local database
  • 9. Deployment MongoDB configuration file: /etc/mongod.conf Before MongoDB 3.0 replSet=MyRepl oplogSize=4096MB YAML format since 3.0 replication: replSetName: MyRepl oplogSizeMB: 4096
  • 10. Deployment • 3 node replica set Node1 Node2 Node3
  • 11. Deployment Node1 /usr/bin/mongod -f mongod.conf > rs.initialize() Node2 Node3 Primary
  • 14. Replica set maintenance • rs.status() • rs.conf() • rs.reconfig() • rs.remove() • rs.stepDown() • rs.freeze() • rs.isMaster() • rs.syncFrom() • rs.printReplicationInfo() • rs.printSlaveReplicationInfo()
  • 15. Configuration options • 50 members per replica set (7 voting members) • Arbiter node • Hidden node • Priority 0 node • Delayed node • Build indexes • Fault tolerance • Write concern • Read preference
  • 16. Configuration options rsTest:PRIMARY> rs.conf() { "_id" : "rsTest", "version" : 2, "members" : [ { "_id" : 0, "host" : "node1:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {"dc" : "apac"}, "slaveDelay" : 0, "votes" : 1 },
  • 17. Arbiter node • Votes in elections • Does not hold copy of data { "_id" : <num> "host" : <hostname:port>, "arbiterOnly" : true, …. } hidden : true
  • 18. Hidden node • Never becomes primary • Not visible to application • Use cases ○ reporting ○ backups { "_id" : <num> "host" : <hostname:port>, "priority" : 0, "hidden" : true } hidden : true
  • 19. Priority 0 node Priority - floating point (i.e. decimal) number between 0 and 1000 • Hidden members and Delayed slave with priority 0 by default • Never becomes primary • Visible to application { "_id" : <num> "host" : <hostname:port>, "priority" : 0 }
  • 20. Delayed node • must be priority 0 member • should be hidden member (not mandatory) • has votes 1 by default • considerations (oplog size) • mainly used for backups { "_id" : <num>, "host" : <hostname:port>, "priority" : 0, "slaveDelay" : <seconds>, "hidden" : true }
  • 21. Build indexes members[n].buildIndexes : false • Can be only set when adding a member to a replica set • Can not be changed on running node • Indexes on _id will still exist • Priority must be set to 0, recommended as hidden:true Useful when • Node is used for backups using mongodump • Node does not receive queries from clients • Adding indexes and maintenance overburdens the host system
  • 22. Fault tolerance Number of members Majority Required to Elect new Primary Fault Tolerance 3 2 1 4 3 1 5 3 2 6 4 2 7 4 3
  • 24. Write concern Write concern specification { w: <value>, j: <boolean>, wtimeout: <number> } • w - number – Option for “majority” • j - write operation has been written to the journal • wtimeout - time limit, in milliseconds, for the write concern Replica set get write concern setting rsTest:PRIMARY> rs.conf().settings['getLastErrorDefaults'] { "w" : 1, "wtimeout" : 0 }
  • 25. Read preference • primary • primaryPreferred • secondary • secondaryPreferred • nearest
  • 26. Key metrics to monitor for RS • Replica set has no Primary • Number of healthy/unhealthy members • Replication Oplog Window • Replication lag
  • 27. What is MySQL Mysql is… ● Transactional ● Relational ● Well documented ● Open source
  • 28. MySQL replication Mysql Replication can be... ● Asynchronous ○ Built-in replication feature ○ Semi-synchronous by plugin rpl_semi_sync_master ● Synchronous ○ Galera setup with wsrep api
  • 29. MySQL replication • Group of mysqld processes that maintain the same data set • Write operations go to the Master node, reads can go to Slave • All changes are recorded into binary log on the master • Asynchronous replication, Semi-Synchronous replication • Slave node replicates the events by copying binary logs as relay logs – IO Thread, SQL Thread – Binary Logs format - Statement, Row, Mixed • Expire logs days dynamic • Replication filters
  • 30. MySQL replication MySQL Master MySQL Process Binary LogsMySQL Data MySQL Slave MySQL Process SQL Thread Relay logs IO Thread MySQL Data