SlideShare a Scribd company logo
1 of 23
Tag-based sharding
Distribute your data as you need
MongoDB User Group
Madrid, October 13th 2015
Juan Antonio Roy Couto
Who am I?
Juan Antonio Roy Couto
Financial Software Developer
Twitter: @juanroycouto
Linkedin: https://www.linkedin.com/in/juanroycouto
Personal blog: http://www.juanroy.es
Contributor at: http://www.mongodbspain.com
Charrosfera member: http://www.charrosfera.com
Email: juanroycouto@gmail.com
MongoDB User Group
Tag-based sharding
❏ Cluster overview
❏ Definitions
❏ Steps for balancing
❏ Steps to split a chunk
❏ Migration steps
❏ Normal MongoDB operation
❏ Pre-splitting
❏ Commands to split a chunk
❏ Tag-based sharding overview
❏ Tag your shards
❏ Tag your chunk ranges
Table of Contents
MongoDB User Group
Tag-based sharding
❏ Replica set
❏ Shards
❏ config servers
❏ config database
❏ mongos
Cluster overview
MongoDB User Group
Tag-based sharding
Cluster overview
Replica Set
● High availability
● Data safety
● Disaster recovery
MongoDB User Group
Tag-based sharding
Replica Set
Secondary
Secondary
Primary
Scale out
Even data distribution across all of the
shards based on a shardkey
A shardkey range belongs to only one
shard
More efficient queries
Cluster overview
Shards
MongoDB User Group
Tag-based sharding
Cluster
Shard 0 Shard 2Shard 1
A-I J-Q R-Z
Cluster overview
MongoDB User Group
Tag-based sharding
Cluster overview
Config servers
MongoDB User Group
Tag-based sharding
● config database
● Identical information (consistency check).
● Metadata:
○ Cluster shards list
○ Data per shard (chunk ranges)
○ ...
● Don’t sync from each other.
● Default Config server (All mongos read it)
Cluster overview
config database
Collections:
● changelog: splits and migration information
● chunks *
● collections * (only sharded)
● databases *
● lockpings
● locks
● mongos
● settings
● shards *
● system.indexes
● tags
● version *
MongoDB User Group
Tag-based sharding
● Receives client requests and returns results.
● Reads the metadata and sends the query to the necessary
shard/shards
● Does not store data
● Keeps a cache version of the metadata. We can refresh it by:
○ mongos>db.runCommand( { flushRouterConfig : 1 } )
○ or restarting the server
Cluster overview
mongos
MongoDB User Group
Tag-based sharding
MongoDB User Group
Tag-based shardingDefinitions
● Range: Data division based on the values of the shardkey.
● Chunk: They are not physical data. Chunks are just a logical
grouping of data into ranges (64MB by default).
● Split: Chunk division. No data is moved.
● Migration: Chunk movements between shards in order to get an
even distribution. Only one chunk is moved at a time.
● Balanced system: The same number of chunks per shard.
● Balancer: Checks if a migration is needed and starts it.
MongoDB User Group
Tag-based sharding
Split
Migration
Steps for balancing
Steps to split a chunk
MongoDB User Group
Tag-based sharding
Shard 0
Final
Shard 0
Chunk 1 Chunk 1
Chunk 2
Chunk 2
Chunk 3
Config
server
mongos
1. Needs chunk 2 to be
splitted?
2. Split points
list
3. Update
metadata
4. Refresh
cache
Migration steps
MongoDB User Group
Tag-based sharding
Shard 1 (To)
Shard 0 (From)
Chunk 4
Chunk 1
Chunk 2
Chunk 3
Config
server
mongos
1. Is balancer running?
2. Is the system imbalance?
3. Pick chunk 3
4. Split chunk 3?
5. Begin (1)
6. Deletes finished?(2)
7. Read this chunk(3)
8. Transfer(4)
9. Update metadata(5)
10. Remove chunk 3 from
shard 0(6)
11. Refresh mongos cache Chunk 3
1
4
7
8
9
1
1
Normal MongoDB operation
MongoDB User Group
Tag-based sharding
Shard 0 Shard 1 Shard 2 Shard 3
mongos
Client
Migrations
Useful for storing data directly
in the shards (massive
data loads).
Avoid bottlenecks.
MongoDB does not need to
split or migrate chunks.
After the split, the migration
must be finished before
data loading.
Pre-splitting
MongoDB User Group
Tag-based sharding
Cluster
Shard 0 Shard 2Shard 1
Chunk 1
Chunk 5
Chunk 3
Chunk 4
Chunk 2
Splitting a chunk:
mongos>for (var i=0; i<20, i++) {
sh.splitAt(“testdb.presplit”, { x : 1000*i } );
}
Querying existing chunks:
mongos>use config
mongos>db.chunks.find( { ns : “testdb.presplit” } )
Commands to split a chunk
MongoDB User Group
Tag-based sharding
Tags are used when you want to pin ranges to a specific shard.
Tag-based sharding overview
MongoDB User Group
Tag-based sharding
shard0
EMEA
shard1
APAC
shard2
LATAM
shard3
NORAM
mongos>sh.addShardTag(“shard0”, “EMEA”)
mongos>sh.addShardTag(“shard1”, “APAC”)
mongos>sh.addShardTag(“shard2”, “LATAM”)
mongos>sh.addShardTag(“shard3”, “NORAM”)
Tag your shards
MongoDB User Group
Tag-based sharding
mongos>sh.addTagRange( namespace, minimum, maximum, tag )
mongos>sh.addTagRange( “testdb.tagrange”,
{ “x” : 0 },
{ “x” : 1000 },
“EMEA” )
minimum: the minimum value (inclusive) of the shard key range to include in the tag.
maximum: the maximum value (exclusive) of the shard key range to include in the tag.
Tag your chunk ranges
MongoDB User Group
Tag-based sharding
Questions?
Questions?
MongoDB User Group
Tag-based sharding
We are looking for writers
mongodbspain.com
MongoDB User Group
Tag-based sharding
Thank you for your attention!
MongoDB User Group
Tag-based sharding
Madrid, October 13th 2015
Juan Antonio Roy Couto

More Related Content

What's hot

Lightning Talk: MongoDB Sharding
Lightning Talk: MongoDB ShardingLightning Talk: MongoDB Sharding
Lightning Talk: MongoDB ShardingMongoDB
 
Sharding
ShardingSharding
ShardingMongoDB
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDBMongoDB
 
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...leifwalsh
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisJason Terpko
 
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 DeploymentMongoDB
 
MongoDB Roadmap
MongoDB RoadmapMongoDB Roadmap
MongoDB RoadmapMongoDB
 
Introduction to Sharding
Introduction to ShardingIntroduction to Sharding
Introduction to ShardingMongoDB
 
Choosing a Shard key
Choosing a Shard keyChoosing a Shard key
Choosing a Shard keyMongoDB
 
Managing Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBManaging Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBJason Terpko
 
Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4 Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4 MongoDB
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialJason Terpko
 
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 ShardingMongoDB
 
Back to Basics Spanish 4 Introduction to sharding
Back to Basics Spanish 4 Introduction to shardingBack to Basics Spanish 4 Introduction to sharding
Back to Basics Spanish 4 Introduction to shardingMongoDB
 
MongoDB Scalability Best Practices
MongoDB Scalability Best PracticesMongoDB Scalability Best Practices
MongoDB Scalability Best PracticesJason Terpko
 
MongoDB - visualisation of slow operations
MongoDB - visualisation of slow operationsMongoDB - visualisation of slow operations
MongoDB - visualisation of slow operationsKay1A
 
MongoDB Chunks - Distribution, Splitting, and Merging
MongoDB Chunks - Distribution, Splitting, and MergingMongoDB Chunks - Distribution, Splitting, and Merging
MongoDB Chunks - Distribution, Splitting, and MergingJason Terpko
 

What's hot (20)

Lightning Talk: MongoDB Sharding
Lightning Talk: MongoDB ShardingLightning Talk: MongoDB Sharding
Lightning Talk: MongoDB Sharding
 
Sharding
ShardingSharding
Sharding
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo Seattle
 
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to RedisMongoDB: Comparing WiredTiger In-Memory Engine to Redis
MongoDB: Comparing WiredTiger In-Memory Engine to Redis
 
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 Roadmap
MongoDB RoadmapMongoDB Roadmap
MongoDB Roadmap
 
MongoDB - Ekino PHP
MongoDB - Ekino PHPMongoDB - Ekino PHP
MongoDB - Ekino PHP
 
Introduction to Sharding
Introduction to ShardingIntroduction to Sharding
Introduction to Sharding
 
Choosing a Shard key
Choosing a Shard keyChoosing a Shard key
Choosing a Shard key
 
Managing Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDBManaging Data and Operation Distribution In MongoDB
Managing Data and Operation Distribution In MongoDB
 
Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4 Advanced Sharding Features in MongoDB 2.4
Advanced Sharding Features in MongoDB 2.4
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster Tutorial
 
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
 
Back to Basics Spanish 4 Introduction to sharding
Back to Basics Spanish 4 Introduction to shardingBack to Basics Spanish 4 Introduction to sharding
Back to Basics Spanish 4 Introduction to sharding
 
MongoDB Scalability Best Practices
MongoDB Scalability Best PracticesMongoDB Scalability Best Practices
MongoDB Scalability Best Practices
 
MongoDB - visualisation of slow operations
MongoDB - visualisation of slow operationsMongoDB - visualisation of slow operations
MongoDB - visualisation of slow operations
 
MongoDB Chunks - Distribution, Splitting, and Merging
MongoDB Chunks - Distribution, Splitting, and MergingMongoDB Chunks - Distribution, Splitting, and Merging
MongoDB Chunks - Distribution, Splitting, and Merging
 

Similar to Tag based sharding presentation

MongoDB : Scaling, Security & Performance
MongoDB : Scaling, Security & PerformanceMongoDB : Scaling, Security & Performance
MongoDB : Scaling, Security & PerformanceSasidhar Gogulapati
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for BeginnersEnoch Joshua
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Consjohnrjenson
 
MongoDB Workshop Universidad de Huelva
MongoDB Workshop Universidad de HuelvaMongoDB Workshop Universidad de Huelva
MongoDB Workshop Universidad de HuelvaJuan Antonio Roy Couto
 
Mongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded DatabasesMongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded DatabasesAbhinav Jha
 
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops TeamEvolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops TeamMydbops
 
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
 
Introduction to Sharding
Introduction to ShardingIntroduction to Sharding
Introduction to ShardingMongoDB
 
Managing data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBManaging data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBAntonios Giannopoulos
 
Sharding in MongoDB 4.2 #what_is_new
 Sharding in MongoDB 4.2 #what_is_new Sharding in MongoDB 4.2 #what_is_new
Sharding in MongoDB 4.2 #what_is_newAntonios Giannopoulos
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEANTroy Miles
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip Zhong
 
MongoDB 3.2 - a giant leap. What’s new?
MongoDB 3.2 - a giant leap. What’s new?MongoDB 3.2 - a giant leap. What’s new?
MongoDB 3.2 - a giant leap. What’s new?Binary Studio
 
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
 
Sharding in MongoDB Days 2013
Sharding in MongoDB Days 2013Sharding in MongoDB Days 2013
Sharding in MongoDB Days 2013Randall Hunt
 
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
 
Sharding
ShardingSharding
ShardingMongoDB
 
Sharding - Seoul 2012
Sharding - Seoul 2012Sharding - Seoul 2012
Sharding - Seoul 2012MongoDB
 

Similar to Tag based sharding presentation (20)

MongoDB : Scaling, Security & Performance
MongoDB : Scaling, Security & PerformanceMongoDB : Scaling, Security & Performance
MongoDB : Scaling, Security & Performance
 
MongoDB for Beginners
MongoDB for BeginnersMongoDB for Beginners
MongoDB for Beginners
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
 
MongoDB Workshop Universidad de Huelva
MongoDB Workshop Universidad de HuelvaMongoDB Workshop Universidad de Huelva
MongoDB Workshop Universidad de Huelva
 
Mongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded DatabasesMongo db cluster administration and Shredded Databases
Mongo db cluster administration and Shredded Databases
 
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops TeamEvolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
 
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 tutorial
mongodb tutorialmongodb tutorial
mongodb tutorial
 
Introduction to Sharding
Introduction to ShardingIntroduction to Sharding
Introduction to Sharding
 
Managing data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBManaging data and operation distribution in MongoDB
Managing data and operation distribution in MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
Sharding in MongoDB 4.2 #what_is_new
 Sharding in MongoDB 4.2 #what_is_new Sharding in MongoDB 4.2 #what_is_new
Sharding in MongoDB 4.2 #what_is_new
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
MongoDB 3.2 - a giant leap. What’s new?
MongoDB 3.2 - a giant leap. What’s new?MongoDB 3.2 - a giant leap. What’s new?
MongoDB 3.2 - a giant leap. What’s new?
 
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
 
Sharding in MongoDB Days 2013
Sharding in MongoDB Days 2013Sharding in MongoDB Days 2013
Sharding in MongoDB Days 2013
 
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
 
Sharding
ShardingSharding
Sharding
 
Sharding - Seoul 2012
Sharding - Seoul 2012Sharding - Seoul 2012
Sharding - Seoul 2012
 

Recently uploaded

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxolyaivanovalion
 
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girl
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girlCall Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girl
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girlkumarajju5765
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Onlineanilsa9823
 

Recently uploaded (20)

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
ALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptxALSO dropshipping via API with DroFx.pptx
ALSO dropshipping via API with DroFx.pptx
 
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girl
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girlCall Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girl
Call Girls 🫤 Dwarka ➡️ 9711199171 ➡️ Delhi 🫦 Two shot with one girl
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Chinhat Lucknow best sexual service Online
 

Tag based sharding presentation

  • 1. Tag-based sharding Distribute your data as you need MongoDB User Group Madrid, October 13th 2015 Juan Antonio Roy Couto
  • 2. Who am I? Juan Antonio Roy Couto Financial Software Developer Twitter: @juanroycouto Linkedin: https://www.linkedin.com/in/juanroycouto Personal blog: http://www.juanroy.es Contributor at: http://www.mongodbspain.com Charrosfera member: http://www.charrosfera.com Email: juanroycouto@gmail.com MongoDB User Group Tag-based sharding
  • 3. ❏ Cluster overview ❏ Definitions ❏ Steps for balancing ❏ Steps to split a chunk ❏ Migration steps ❏ Normal MongoDB operation ❏ Pre-splitting ❏ Commands to split a chunk ❏ Tag-based sharding overview ❏ Tag your shards ❏ Tag your chunk ranges Table of Contents MongoDB User Group Tag-based sharding
  • 4. ❏ Replica set ❏ Shards ❏ config servers ❏ config database ❏ mongos Cluster overview MongoDB User Group Tag-based sharding
  • 5. Cluster overview Replica Set ● High availability ● Data safety ● Disaster recovery MongoDB User Group Tag-based sharding Replica Set Secondary Secondary Primary
  • 6. Scale out Even data distribution across all of the shards based on a shardkey A shardkey range belongs to only one shard More efficient queries Cluster overview Shards MongoDB User Group Tag-based sharding Cluster Shard 0 Shard 2Shard 1 A-I J-Q R-Z
  • 7. Cluster overview MongoDB User Group Tag-based sharding
  • 8. Cluster overview Config servers MongoDB User Group Tag-based sharding ● config database ● Identical information (consistency check). ● Metadata: ○ Cluster shards list ○ Data per shard (chunk ranges) ○ ... ● Don’t sync from each other. ● Default Config server (All mongos read it)
  • 9. Cluster overview config database Collections: ● changelog: splits and migration information ● chunks * ● collections * (only sharded) ● databases * ● lockpings ● locks ● mongos ● settings ● shards * ● system.indexes ● tags ● version * MongoDB User Group Tag-based sharding
  • 10. ● Receives client requests and returns results. ● Reads the metadata and sends the query to the necessary shard/shards ● Does not store data ● Keeps a cache version of the metadata. We can refresh it by: ○ mongos>db.runCommand( { flushRouterConfig : 1 } ) ○ or restarting the server Cluster overview mongos MongoDB User Group Tag-based sharding
  • 11. MongoDB User Group Tag-based shardingDefinitions ● Range: Data division based on the values of the shardkey. ● Chunk: They are not physical data. Chunks are just a logical grouping of data into ranges (64MB by default). ● Split: Chunk division. No data is moved. ● Migration: Chunk movements between shards in order to get an even distribution. Only one chunk is moved at a time. ● Balanced system: The same number of chunks per shard. ● Balancer: Checks if a migration is needed and starts it.
  • 12. MongoDB User Group Tag-based sharding Split Migration Steps for balancing
  • 13. Steps to split a chunk MongoDB User Group Tag-based sharding Shard 0 Final Shard 0 Chunk 1 Chunk 1 Chunk 2 Chunk 2 Chunk 3 Config server mongos 1. Needs chunk 2 to be splitted? 2. Split points list 3. Update metadata 4. Refresh cache
  • 14. Migration steps MongoDB User Group Tag-based sharding Shard 1 (To) Shard 0 (From) Chunk 4 Chunk 1 Chunk 2 Chunk 3 Config server mongos 1. Is balancer running? 2. Is the system imbalance? 3. Pick chunk 3 4. Split chunk 3? 5. Begin (1) 6. Deletes finished?(2) 7. Read this chunk(3) 8. Transfer(4) 9. Update metadata(5) 10. Remove chunk 3 from shard 0(6) 11. Refresh mongos cache Chunk 3 1 4 7 8 9 1 1
  • 15. Normal MongoDB operation MongoDB User Group Tag-based sharding Shard 0 Shard 1 Shard 2 Shard 3 mongos Client Migrations
  • 16. Useful for storing data directly in the shards (massive data loads). Avoid bottlenecks. MongoDB does not need to split or migrate chunks. After the split, the migration must be finished before data loading. Pre-splitting MongoDB User Group Tag-based sharding Cluster Shard 0 Shard 2Shard 1 Chunk 1 Chunk 5 Chunk 3 Chunk 4 Chunk 2
  • 17. Splitting a chunk: mongos>for (var i=0; i<20, i++) { sh.splitAt(“testdb.presplit”, { x : 1000*i } ); } Querying existing chunks: mongos>use config mongos>db.chunks.find( { ns : “testdb.presplit” } ) Commands to split a chunk MongoDB User Group Tag-based sharding
  • 18. Tags are used when you want to pin ranges to a specific shard. Tag-based sharding overview MongoDB User Group Tag-based sharding shard0 EMEA shard1 APAC shard2 LATAM shard3 NORAM
  • 19. mongos>sh.addShardTag(“shard0”, “EMEA”) mongos>sh.addShardTag(“shard1”, “APAC”) mongos>sh.addShardTag(“shard2”, “LATAM”) mongos>sh.addShardTag(“shard3”, “NORAM”) Tag your shards MongoDB User Group Tag-based sharding
  • 20. mongos>sh.addTagRange( namespace, minimum, maximum, tag ) mongos>sh.addTagRange( “testdb.tagrange”, { “x” : 0 }, { “x” : 1000 }, “EMEA” ) minimum: the minimum value (inclusive) of the shard key range to include in the tag. maximum: the maximum value (exclusive) of the shard key range to include in the tag. Tag your chunk ranges MongoDB User Group Tag-based sharding
  • 22. We are looking for writers mongodbspain.com MongoDB User Group Tag-based sharding
  • 23. Thank you for your attention! MongoDB User Group Tag-based sharding Madrid, October 13th 2015 Juan Antonio Roy Couto

Editor's Notes

  1. Shard TO steps: 1 Creación de índices 2 Borrado docs en rango 3 Transfer start 4 Transfer starts 5 Transfer ends