SlideShare a Scribd company logo
First steps with MongoDB




              
Index
    When you should use  NoSQL
    When you should not use NoSQL
    A quick look at MongoDB
    Other features
    Main scheme
    Replication
    Auto­sharding
    Architecture
    First steps
                                  
When should I use NoSQL?


 Caching
 High data amount
 Horizontal scalability(without joins or complex 
  transactions)


 The Slogan is ”not only SQL”  and ”not only 
  NOSQL” 

                             
When should not I use
NoSQL


    High transaction level
    Business Intelligence
    Problems that need relational queries




                               
A quick look at MongoDB

    Document database oriented (BSON)
    Flexible scheme
    Dinamic queries
    Replication
    Auto­sharding
    Atomic operations
    Full indexes

                             
A quick look at MongoDB

    Not relational
    Distributed
    Opensource
    Horizontal scalability
    Drivers for most known programming languages
    Replication and automatic sharding
    GridFS

                               
Other features

    Map Reduce
      Queries are executed in parallel in all of the shards
      Adittion and process of flexible data
    Geospatial index
      Find objects based on their geographical location 




                                    
Basic scheme

Database Server
Shell
Sharding router


            Mongod                               Mongo
        Database server                     Interactive shell



                             Mongos
                          Sharding router


                                       
Replication

    Master: mongod –master
    Slave: mongod –source url:port or pasive –slavedelay 
      numberofseconds
    Replica Sets
      Full support in dealing with failures(recommended by each 
        shard)
      You can have passive members that never will be masters.
    Master­master
      Only recommended for insert and delete queries by id.
                                  
Auto-sharding

    Defined by a shard key
    Response in dealing with failures is handled by each 
     replica set.
    Queries map reduce could run in paralell between 
     many shards.
    You can add servers as shards and automatically data 
     are distributed along of all shards. 



                                
Fragmentation




             
Fragmentation




             
Architecture
    Shards Servers: mongod –shardsvr
    You can configure replication to dealing with failures.
    Shards Routers: mongos –configdb 
     urlconfig:portconfig
    It is the shell for the rest of clients.
    It can be executed in an application server for reduce 
       the load of the server.
    Config Routers:mongod –configsvr
    Recommended a group of 3
                                   
Logical architecture




               
Important note
    _id
      Special key
      Present in all stored documents
      Unique to each collection
      It can be the type you want




                                     
First step with sharding

    use admin
    db.runCommand( { addshard : "pre­mongo1:10000" } );
    db.runCommand( { addshard : "pre­mongo2:10000" } );
    db.runCommand( { enablesharding : "activities" } );
    db.runCommand( { shardcollection : 
      "activities.userWall" , key : { userId: 1 } } );
    db.printShardingStatus()


                                  
Backup

    EC2 → Snapshot EBS
    LVM→ Snapshot LV
    FS→mysqldump, dd (with sharding not recommended)
    Weak point of sharding.
    More details ­> http://bit.ly/wNdlIA




                                
Questions?




              
Who am I?

    Spanish web: http://www.juanvicenteherrera.es
    English web: http://www.juanvicenteherrera.eu
    Twitter: http://twitter.com/jvicenteherrera
    LinkedIn: http://es.linkedin.com/in/jvherrera




                                

More Related Content

PPT
Aleksandr_Butenko_Mobile_Development
PPTX
mongodb-brief-intro-february-2012
PDF
Gcd and concurrency programming
PPT
MongoDB Basic Concepts
PDF
X3
PPTX
mongoDB for sysadmins
PDF
RelStorage Plone Zope RDB Storage Backend
PDF
Supercharge your next Vue app with Nuxt
Aleksandr_Butenko_Mobile_Development
mongodb-brief-intro-february-2012
Gcd and concurrency programming
MongoDB Basic Concepts
X3
mongoDB for sysadmins
RelStorage Plone Zope RDB Storage Backend
Supercharge your next Vue app with Nuxt

What's hot (20)

PDF
dba_lounge_Iasi: Everybody likes redis
PPTX
NodeJS Presentation
PDF
Node
PDF
Node.js introduction
PPT
Oreilly Webcast Jun17
PDF
Mini-review + cheat sheet: ZFS on FUSE
PDF
Juju, LXC, OpenStack: Fun with Private Clouds
PPT
Mysql talk
PPTX
Ops Jumpstart: Admin 101
PDF
ngServer and-collaboratived-development-between-san-francisco-and-tokyo
PDF
GruntJS + Wordpress
PPTX
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
PPTX
Strategies for Backing Up MongoDB
PDF
Create a RESTful API with NodeJS, Express and MongoDB
PPTX
The cassandra odyssey
ODP
Barcamp MySQL
PDF
Elastic jenkins
PDF
Cassandra Anti-Patterns
PDF
MongoUK - Approaching 1 billion documents with MongoDB1 Billion Documents
PDF
Erlang scheduler
dba_lounge_Iasi: Everybody likes redis
NodeJS Presentation
Node
Node.js introduction
Oreilly Webcast Jun17
Mini-review + cheat sheet: ZFS on FUSE
Juju, LXC, OpenStack: Fun with Private Clouds
Mysql talk
Ops Jumpstart: Admin 101
ngServer and-collaboratived-development-between-san-francisco-and-tokyo
GruntJS + Wordpress
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Strategies for Backing Up MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
The cassandra odyssey
Barcamp MySQL
Elastic jenkins
Cassandra Anti-Patterns
MongoUK - Approaching 1 billion documents with MongoDB1 Billion Documents
Erlang scheduler
Ad

Viewers also liked (20)

PPTX
PPTX
Getting Started with MongoDB
KEY
Mongodb intro
KEY
Introduction to MongoDB
ODP
Seth Edwards on MongoDB
PDF
Intro to NoSQL and MongoDB
PPTX
Schema design with MongoDB (Dwight Merriman)
PPTX
Mastering the MongoDB Javascript Shell
ODP
Introduction to MongoDB
KEY
An Evening with MongoDB - Orlando: Welcome and Keynote
ODP
Introduction to MongoDB
PPTX
MongoDB 3.0
PDF
Plan de entrenamiento Maratón de Madrid Mes 3
PPTX
Mongo db intro new
PDF
Zero to Mongo in 60 Hours
PDF
Text databases and information retrieval
PDF
Mongodb
PDF
Mongo DB on the JVM - Brendan McAdams
PDF
MongoDB 3.2 Feature Preview
Getting Started with MongoDB
Mongodb intro
Introduction to MongoDB
Seth Edwards on MongoDB
Intro to NoSQL and MongoDB
Schema design with MongoDB (Dwight Merriman)
Mastering the MongoDB Javascript Shell
Introduction to MongoDB
An Evening with MongoDB - Orlando: Welcome and Keynote
Introduction to MongoDB
MongoDB 3.0
Plan de entrenamiento Maratón de Madrid Mes 3
Mongo db intro new
Zero to Mongo in 60 Hours
Text databases and information retrieval
Mongodb
Mongo DB on the JVM - Brendan McAdams
MongoDB 3.2 Feature Preview
Ad

Similar to MongoDB Devops Madrid February 2012 (20)

KEY
Sharding with MongoDB (Eliot Horowitz)
KEY
Sharding with MongoDB (Eliot Horowitz)
PPT
2011 mongo FR - scaling with mongodb
KEY
2011 mongo sf-scaling
PDF
Mongo db transcript
PDF
Mongodb workshop
KEY
Scaling with MongoDB
PDF
MongoDB - An Introduction
KEY
Scaling MongoDB (Mongo Austin)
PPTX
MongoDB Internals
PPT
MongoDB Knowledge Shareing
PDF
MongoDB: Advantages of an Open Source NoSQL Database
KEY
Mongodb sharding
PPTX
Agility and Scalability with MongoDB
PPTX
MongoDB: An Introduction - june-2011
PDF
Introduction to Mongodb
PPTX
DBVersity MongoDB Online Training Presentations
PDF
Introduction to MongoDB
PPT
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
KEY
The Care + Feeding of a Mongodb Cluster
Sharding with MongoDB (Eliot Horowitz)
Sharding with MongoDB (Eliot Horowitz)
2011 mongo FR - scaling with mongodb
2011 mongo sf-scaling
Mongo db transcript
Mongodb workshop
Scaling with MongoDB
MongoDB - An Introduction
Scaling MongoDB (Mongo Austin)
MongoDB Internals
MongoDB Knowledge Shareing
MongoDB: Advantages of an Open Source NoSQL Database
Mongodb sharding
Agility and Scalability with MongoDB
MongoDB: An Introduction - june-2011
Introduction to Mongodb
DBVersity MongoDB Online Training Presentations
Introduction to MongoDB
MONGODB VASUDEV PRAJAPATI DOCUMENTBASE DATABASE
The Care + Feeding of a Mongodb Cluster

More from Juan Vicente Herrera Ruiz de Alejo (20)

PDF
Un puente enre MLops y Devops con Openshift AI
PDF
Practical Threat Modeling - WorldParty 2k23 HackMadrid.pdf
PDF
PDF
OpenShift Multicluster
PDF
Deploying Minecraft with Ansible
PDF
Tell me how you provision and I'll tell you how you are
PDF
Santander DevopsandCloudDays 2021 - Hardening containers.pdf
PDF
X by orange; una telco en la nube
PDF
Dorsal carrera de la mujer ROSAE 2017
PDF
Cartel carrera de la mujer ROSAE 2017
PDF
Volkswagen Prague Marathon 2017
PDF
Plan de entrenamiento Maratón de Madrid Mes 2
PDF
Plan de entrenamiento Maratón de Madrid Mes 1
PDF
Cartel carrera de la mujer ROSAE 2014
PPT
AWS migration: getting to Data Center heaven with AWS and Chef
ODP
Devops madrid: successful case in AWS
ODP
Devops Madrid Marzo - Caso de uso en AWS
ODP
Configuration management with Chef
ODP
DevOps and Chef improve your life
ODP
Amazon EC2: What is this and what can I do with it?
Un puente enre MLops y Devops con Openshift AI
Practical Threat Modeling - WorldParty 2k23 HackMadrid.pdf
OpenShift Multicluster
Deploying Minecraft with Ansible
Tell me how you provision and I'll tell you how you are
Santander DevopsandCloudDays 2021 - Hardening containers.pdf
X by orange; una telco en la nube
Dorsal carrera de la mujer ROSAE 2017
Cartel carrera de la mujer ROSAE 2017
Volkswagen Prague Marathon 2017
Plan de entrenamiento Maratón de Madrid Mes 2
Plan de entrenamiento Maratón de Madrid Mes 1
Cartel carrera de la mujer ROSAE 2014
AWS migration: getting to Data Center heaven with AWS and Chef
Devops madrid: successful case in AWS
Devops Madrid Marzo - Caso de uso en AWS
Configuration management with Chef
DevOps and Chef improve your life
Amazon EC2: What is this and what can I do with it?

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
cuic standard and advanced reporting.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
A Presentation on Artificial Intelligence
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Monthly Chronicles - July 2025
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
cuic standard and advanced reporting.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
A Presentation on Artificial Intelligence
Network Security Unit 5.pdf for BCA BBA.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

MongoDB Devops Madrid February 2012

  • 1. First steps with MongoDB    
  • 2. Index When you should use  NoSQL When you should not use NoSQL A quick look at MongoDB Other features Main scheme Replication Auto­sharding Architecture First steps    
  • 3. When should I use NoSQL? Caching High data amount Horizontal scalability(without joins or complex  transactions) The Slogan is ”not only SQL”  and ”not only  NOSQL”     
  • 4. When should not I use NoSQL High transaction level Business Intelligence Problems that need relational queries    
  • 5. A quick look at MongoDB Document database oriented (BSON) Flexible scheme Dinamic queries Replication Auto­sharding Atomic operations Full indexes    
  • 6. A quick look at MongoDB Not relational Distributed Opensource Horizontal scalability Drivers for most known programming languages Replication and automatic sharding GridFS    
  • 7. Other features Map Reduce Queries are executed in parallel in all of the shards Adittion and process of flexible data Geospatial index Find objects based on their geographical location     
  • 8. Basic scheme Database Server Shell Sharding router Mongod Mongo Database server Interactive shell Mongos Sharding router    
  • 9. Replication Master: mongod –master Slave: mongod –source url:port or pasive –slavedelay  numberofseconds Replica Sets Full support in dealing with failures(recommended by each  shard) You can have passive members that never will be masters. Master­master Only recommended for insert and delete queries by id.    
  • 10. Auto-sharding Defined by a shard key Response in dealing with failures is handled by each  replica set. Queries map reduce could run in paralell between  many shards. You can add servers as shards and automatically data  are distributed along of all shards.     
  • 13. Architecture Shards Servers: mongod –shardsvr You can configure replication to dealing with failures. Shards Routers: mongos –configdb  urlconfig:portconfig It is the shell for the rest of clients. It can be executed in an application server for reduce  the load of the server. Config Routers:mongod –configsvr Recommended a group of 3    
  • 15. Important note _id Special key Present in all stored documents Unique to each collection It can be the type you want    
  • 16. First step with sharding use admin db.runCommand( { addshard : "pre­mongo1:10000" } ); db.runCommand( { addshard : "pre­mongo2:10000" } ); db.runCommand( { enablesharding : "activities" } ); db.runCommand( { shardcollection :  "activities.userWall" , key : { userId: 1 } } ); db.printShardingStatus()    
  • 17. Backup EC2 → Snapshot EBS LVM→ Snapshot LV FS→mysqldump, dd (with sharding not recommended) Weak point of sharding. More details ­> http://bit.ly/wNdlIA    
  • 19. Who am I? Spanish web: http://www.juanvicenteherrera.es English web: http://www.juanvicenteherrera.eu Twitter: http://twitter.com/jvicenteherrera LinkedIn: http://es.linkedin.com/in/jvherrera