SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
MongoDB Basic Concepts

                                    Norberto Leite

                            Senior Solutions Architect, EMEA
                                 norberto@10gen.com
                                         @nleite




Thursday, 25 October 12
Agenda

        •Overview
        •Replication
        •Scalability
        •Consistency & Durability
        •Flexibility, Developer Experienc




Thursday, 25 October 12
Your data needs started here...




                                   http://bit.ly/OT71M4
Thursday, 25 October 12
...but soon you had to be here




                                   http://bit.ly/Oxcsis

Thursday, 25 October 12
Basic Concepts
                            Application    Document
                                           Oriented
         High                              { author : “steve”,
                                             date : new Date(),
                                             text : “About MongoDB...”,
     Performance                             tags : [“tech”, “database”]}




                                             Fully
                                           Consistent

                   Horizontally Scalable

Thursday, 25 October 12
Tradeoff: Scale vs Functionality

                                    • memcached
        scalability & performance




                                       •key/value



                                                                     • RDBMS



                                            depth of functionality
Thursday, 25 October 12
Replication




Thursday, 25 October 12
Why do we need replication

        •Failover
        •Backups
        •Secondary batch jobs
        •High availability




Thursday, 25 October 12
Replica Sets
        Data Availability across nodes
        • Data Protection
          • Multiple copies of the data
          • Spread across Data Centers, AZs
        • High Availability
          • Automated Failover
          • Automated Recovery




Thursday, 25 October 12
Replica Sets


                 App      Write
                                   Primary
                                              Asynchronous
                          Read                 Replication

                                  Secondary
                          Read


                                  Secondary
                          Read




Thursday, 25 October 12
Replica Sets


                 App      Write
                                   Primary
                          Read

                                  Secondary
                          Read


                                  Secondary
                          Read




Thursday, 25 October 12
Replica Sets


                 App
                                   Primary

                          Write
                                   Primary    Automatic Election of
                                                  new Primary
                          Read

                                  Secondary
                          Read




Thursday, 25 October 12
Replica Sets


                 App
                                  Recovering

                          Write                New primary serves
                                   Primary            data
                          Read

                                  Secondary
                          Read




Thursday, 25 October 12
Replica Sets


                 App
                                  Secondary
                          Read

                          Write
                                   Primary
                          Read

                                  Secondary
                          Read




Thursday, 25 October 12
Scalability




Thursday, 25 October 12
Horizontal Scalability




Thursday, 25 October 12
Sharding
        Data Distribution across nodes
        • Data location transparent to your code
        • Data distribution is automatic
        • Data re-distribution is automatic
        • Aggregate system resources horizontally
        • No code changes




Thursday, 25 October 12
Sharding - Range distribution

                          sh.shardCollection("test.tweets", {_id: 1} , false)


                          shard01                     shard02                   shard03




Thursday, 25 October 12
Sharding - Range distribution


                          shard01   shard02   shard03

                           a-i        j-r      s-z




Thursday, 25 October 12
Sharding - Splits


                          shard01   shard02   shard03

                           a-i      ja-jz      s-z
                                     k-r




Thursday, 25 October 12
Sharding - Splits


                          shard01   shard02   shard03

                           a-i       ja-ji     s-z
                                     ji-js
                                    js-jw
                                     jz-r

Thursday, 25 October 12
Sharding - Auto Balancing


                          shard01   shard02   shard03

                           a-i       ja-ji     s-z
                                     ji-js
                          js-jw     js-jw
                                     jz-r      jz-r

Thursday, 25 October 12
Sharding - Auto Balancing


                          shard01   shard02   shard03

                           a-i       ja-ji     n-z
                                     ji-js
                          js-jw
                                               jz-r

Thursday, 25 October 12
Sharding - Routed Query
                                              find({_id: "norberto"})




                          shard01   shard02                  shard03

                           a-i       ja-ji                     n-z
                                     ji-js
                          js-jw
                                                               jz-r

Thursday, 25 October 12
Sharding - Routed Query
                                              find({_id: "norberto"})




                          shard01   shard02                  shard03

                           a-i       ja-ji                     n-z
                                     ji-js
                          js-jw
                                                               jz-r

Thursday, 25 October 12
Sharding - Scatter Gather
                                         find({email: "norberto@10gen.com"})




                          shard01   shard02                shard03

                           a-i       ja-ji                  n-z
                                     ji-js
                          js-jw
                                                            jz-r

Thursday, 25 October 12
Sharding - Scatter Gather
                                         find({email: "norberto@10gen.com"})




                          shard01   shard02                shard03

                           a-i       ja-ji                  n-z
                                     ji-js
                          js-jw
                                                            jz-r

Thursday, 25 October 12
Sharding - Caching
                       96 GB Mem
                      3:1 Data/Mem


                          shard01

                           a-i
     300 GB Data




                           j-r
                           n-z

                           300 GB



Thursday, 25 October 12
Aggregate Horizontal Resources
                       96 GB Mem      96 GB Mem      96 GB Mem
                      1:1 Data/Mem   1:1 Data/Mem   1:1 Data/Mem


                          shard01    shard02        shard03

                           a-i          j-r           n-z
     300 GB Data




                           100 GB      100 GB        100 GB


Thursday, 25 October 12
Consistency & Durability




Thursday, 25 October 12
Two choices for consistency

        •Eventual consistency
                •Allow updates when a system has been partitioned
                •Resolve conflicts later
                •Example: CouchDB, Cassandra

        •Immediate consistency
                •Limit the application of updates to a single master
                node for a given slice of data
                          •Another node can take over after a failure is detected
                •Avoids the possibility of conflicts
                •Example: MongoDB



Thursday, 25 October 12
Durability

        •For how long is my data available?
        •When do I now that my data is safe?
        •Where?
        •Mongodb style
                •Fire and Forget
                •Get Last Error
                •Journal Sync
                •Replica Safe



Thursday, 25 October 12
Data Durability




Thursday, 25 October 12
Flexibility




Thursday, 25 October 12
Data Model

        • Why JSON?
                • Provides a simple, well understood
                encapsulation of data
                • Maps simply to the object in your OO language
                • Linking & Embedding to describe relationships




Thursday, 25 October 12
Json




        place1 = {
        
 name : "10gen HQ",
        
 address : "578 Broadway 7th Floor",
        
 city : "New York",
        
   zip : "10011",
           tags : [ "business", "tech" ]
        }
Thursday, 25 October 12
Schema Design
        Relational Database




Thursday, 25 October 12
Schema Design
        MongoDB                     embedding




                          linking
Thursday, 25 October 12
Schemas in MongoDB

     Design documents that simply map to
     your application
     post = {author: "Hergé",
          date: new Date(),
          text: "Destination Moon",
          tags: ["comic", "adventure"]}

     > db.posts.save(post)


Thursday, 25 October 12
Embedding
       > db.blogs.find( { author: "Hergé"} )

         { _id : ObjectId("4c4ba5c0672c685e5e8aabf3"),
           author : "Hergé",
           date : ISODate("2011-09-18T09:56:06.298Z"),
           text : "Destination Moon",
           tags : [ "comic", "adventure" ],
           comments : [
   !         {
   !       !    author : "Kyle",
   !       !    date : ISODate("2011-09-19T09:56:06.298Z"),
   !       !    text : "great book"
   !         }
           ]
         }




Thursday, 25 October 12
JSON & Scaleout

        • Embedding removes need for
                • Distributed Joins
                • Two Phase commit
        • Enables data to be distributed across many nodes
        without penalty




Thursday, 25 October 12
http://bit.ly/UmUnsU
Thursday, 25 October 12
http://bit.ly/cnP77L
Thursday, 25 October 12
http://bit.ly/ODoMhh
Thursday, 25 October 12
http://bit.ly/uW2nk
Thursday, 25 October 12
download at mongodb.org!

                                     norberto@10gen.com

                          Support, Training, Consulting, Events, Meetups
                                     http://www.10gen.com



        Facebook!                            Twitter!                     LinkedIn!
  http://bit.ly/mongofb!              http://twitter.com/mongodb!   http://linkd.in/joinmongo!




Thursday, 25 October 12

Mais conteúdo relacionado

Mais procurados

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBRavi Teja
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화NAVER D2
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger InternalsNorberto Leite
 
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDBNAVER D2
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with RedisGeorge Platon
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013mumrah
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
MongoDB Atlas
MongoDB AtlasMongoDB Atlas
MongoDB AtlasMongoDB
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?lucenerevolution
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
MongoDB Sharding
MongoDB ShardingMongoDB Sharding
MongoDB ShardingRob Walters
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
When to Use MongoDB
When to Use MongoDBWhen to Use MongoDB
When to Use MongoDBMongoDB
 

Mais procurados (20)

Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB
[124]네이버에서 사용되는 여러가지 Data Platform, 그리고 MongoDB
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
MongoDB Atlas
MongoDB AtlasMongoDB Atlas
MongoDB Atlas
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
MongoDB Sharding
MongoDB ShardingMongoDB Sharding
MongoDB Sharding
 
Redis introduction
Redis introductionRedis introduction
Redis introduction
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
When to Use MongoDB
When to Use MongoDBWhen to Use MongoDB
When to Use MongoDB
 

Semelhante a MongoDB Fundamentals

A Morning with MongoDB Barcelona: MongoDB Basic Concepts
A Morning with MongoDB Barcelona: MongoDB Basic ConceptsA Morning with MongoDB Barcelona: MongoDB Basic Concepts
A Morning with MongoDB Barcelona: MongoDB Basic ConceptsMongoDB
 
Morning with MongoDB Paris 2012 - MongoDB Basic Concepts
Morning with MongoDB Paris 2012 - MongoDB Basic ConceptsMorning with MongoDB Paris 2012 - MongoDB Basic Concepts
Morning with MongoDB Paris 2012 - MongoDB Basic ConceptsMongoDB
 
Workshop: Introduction to the Disruptor
Workshop: Introduction to the DisruptorWorkshop: Introduction to the Disruptor
Workshop: Introduction to the DisruptorTrisha Gee
 
Secrets of the asset pipeline
Secrets of the asset pipelineSecrets of the asset pipeline
Secrets of the asset pipelineKen Collins
 
Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)packetloop
 
Design patterns in Ruby
Design patterns in RubyDesign patterns in Ruby
Design patterns in Rubyrussolsen
 
Personal kaizen
Personal kaizenPersonal kaizen
Personal kaizenSqueed
 
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012Gigaom
 
Peeling back your Network Layers with Security Onion
Peeling back your Network Layers with Security OnionPeeling back your Network Layers with Security Onion
Peeling back your Network Layers with Security OnionMark Hillick
 
Backend as a Service
Backend as a ServiceBackend as a Service
Backend as a ServiceLutz Kohl
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Brasil
 
NoSql _ MongoDB - Italian Market copy
NoSql _ MongoDB - Italian Market copyNoSql _ MongoDB - Italian Market copy
NoSql _ MongoDB - Italian Market copyMongoDB
 
Cloudstack talk
Cloudstack talkCloudstack talk
Cloudstack talkbodepd
 

Semelhante a MongoDB Fundamentals (14)

A Morning with MongoDB Barcelona: MongoDB Basic Concepts
A Morning with MongoDB Barcelona: MongoDB Basic ConceptsA Morning with MongoDB Barcelona: MongoDB Basic Concepts
A Morning with MongoDB Barcelona: MongoDB Basic Concepts
 
Morning with MongoDB Paris 2012 - MongoDB Basic Concepts
Morning with MongoDB Paris 2012 - MongoDB Basic ConceptsMorning with MongoDB Paris 2012 - MongoDB Basic Concepts
Morning with MongoDB Paris 2012 - MongoDB Basic Concepts
 
Workshop: Introduction to the Disruptor
Workshop: Introduction to the DisruptorWorkshop: Introduction to the Disruptor
Workshop: Introduction to the Disruptor
 
Secrets of the asset pipeline
Secrets of the asset pipelineSecrets of the asset pipeline
Secrets of the asset pipeline
 
Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)
 
Design patterns in Ruby
Design patterns in RubyDesign patterns in Ruby
Design patterns in Ruby
 
Personal kaizen
Personal kaizenPersonal kaizen
Personal kaizen
 
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012
SMART TOOLS: DISSECT, DIGEST AND DELIVER BIG DATA from Structure:Data 2012
 
Peeling back your Network Layers with Security Onion
Peeling back your Network Layers with Security OnionPeeling back your Network Layers with Security Onion
Peeling back your Network Layers with Security Onion
 
Selenium Basics
Selenium BasicsSelenium Basics
Selenium Basics
 
Backend as a Service
Backend as a ServiceBackend as a Service
Backend as a Service
 
MySQL Cluster no PayPal
MySQL Cluster no PayPalMySQL Cluster no PayPal
MySQL Cluster no PayPal
 
NoSql _ MongoDB - Italian Market copy
NoSql _ MongoDB - Italian Market copyNoSql _ MongoDB - Italian Market copy
NoSql _ MongoDB - Italian Market copy
 
Cloudstack talk
Cloudstack talkCloudstack talk
Cloudstack talk
 

Mais de MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

Mais de MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

MongoDB Fundamentals

  • 1. MongoDB Basic Concepts Norberto Leite Senior Solutions Architect, EMEA norberto@10gen.com @nleite Thursday, 25 October 12
  • 2. Agenda •Overview •Replication •Scalability •Consistency & Durability •Flexibility, Developer Experienc Thursday, 25 October 12
  • 3. Your data needs started here... http://bit.ly/OT71M4 Thursday, 25 October 12
  • 4. ...but soon you had to be here http://bit.ly/Oxcsis Thursday, 25 October 12
  • 5. Basic Concepts Application Document Oriented High { author : “steve”, date : new Date(), text : “About MongoDB...”, Performance tags : [“tech”, “database”]} Fully Consistent Horizontally Scalable Thursday, 25 October 12
  • 6. Tradeoff: Scale vs Functionality • memcached scalability & performance •key/value • RDBMS depth of functionality Thursday, 25 October 12
  • 8. Why do we need replication •Failover •Backups •Secondary batch jobs •High availability Thursday, 25 October 12
  • 9. Replica Sets Data Availability across nodes • Data Protection • Multiple copies of the data • Spread across Data Centers, AZs • High Availability • Automated Failover • Automated Recovery Thursday, 25 October 12
  • 10. Replica Sets App Write Primary Asynchronous Read Replication Secondary Read Secondary Read Thursday, 25 October 12
  • 11. Replica Sets App Write Primary Read Secondary Read Secondary Read Thursday, 25 October 12
  • 12. Replica Sets App Primary Write Primary Automatic Election of new Primary Read Secondary Read Thursday, 25 October 12
  • 13. Replica Sets App Recovering Write New primary serves Primary data Read Secondary Read Thursday, 25 October 12
  • 14. Replica Sets App Secondary Read Write Primary Read Secondary Read Thursday, 25 October 12
  • 17. Sharding Data Distribution across nodes • Data location transparent to your code • Data distribution is automatic • Data re-distribution is automatic • Aggregate system resources horizontally • No code changes Thursday, 25 October 12
  • 18. Sharding - Range distribution sh.shardCollection("test.tweets", {_id: 1} , false) shard01 shard02 shard03 Thursday, 25 October 12
  • 19. Sharding - Range distribution shard01 shard02 shard03 a-i j-r s-z Thursday, 25 October 12
  • 20. Sharding - Splits shard01 shard02 shard03 a-i ja-jz s-z k-r Thursday, 25 October 12
  • 21. Sharding - Splits shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw jz-r Thursday, 25 October 12
  • 22. Sharding - Auto Balancing shard01 shard02 shard03 a-i ja-ji s-z ji-js js-jw js-jw jz-r jz-r Thursday, 25 October 12
  • 23. Sharding - Auto Balancing shard01 shard02 shard03 a-i ja-ji n-z ji-js js-jw jz-r Thursday, 25 October 12
  • 24. Sharding - Routed Query find({_id: "norberto"}) shard01 shard02 shard03 a-i ja-ji n-z ji-js js-jw jz-r Thursday, 25 October 12
  • 25. Sharding - Routed Query find({_id: "norberto"}) shard01 shard02 shard03 a-i ja-ji n-z ji-js js-jw jz-r Thursday, 25 October 12
  • 26. Sharding - Scatter Gather find({email: "norberto@10gen.com"}) shard01 shard02 shard03 a-i ja-ji n-z ji-js js-jw jz-r Thursday, 25 October 12
  • 27. Sharding - Scatter Gather find({email: "norberto@10gen.com"}) shard01 shard02 shard03 a-i ja-ji n-z ji-js js-jw jz-r Thursday, 25 October 12
  • 28. Sharding - Caching 96 GB Mem 3:1 Data/Mem shard01 a-i 300 GB Data j-r n-z 300 GB Thursday, 25 October 12
  • 29. Aggregate Horizontal Resources 96 GB Mem 96 GB Mem 96 GB Mem 1:1 Data/Mem 1:1 Data/Mem 1:1 Data/Mem shard01 shard02 shard03 a-i j-r n-z 300 GB Data 100 GB 100 GB 100 GB Thursday, 25 October 12
  • 31. Two choices for consistency •Eventual consistency •Allow updates when a system has been partitioned •Resolve conflicts later •Example: CouchDB, Cassandra •Immediate consistency •Limit the application of updates to a single master node for a given slice of data •Another node can take over after a failure is detected •Avoids the possibility of conflicts •Example: MongoDB Thursday, 25 October 12
  • 32. Durability •For how long is my data available? •When do I now that my data is safe? •Where? •Mongodb style •Fire and Forget •Get Last Error •Journal Sync •Replica Safe Thursday, 25 October 12
  • 35. Data Model • Why JSON? • Provides a simple, well understood encapsulation of data • Maps simply to the object in your OO language • Linking & Embedding to describe relationships Thursday, 25 October 12
  • 36. Json place1 = { name : "10gen HQ", address : "578 Broadway 7th Floor", city : "New York", zip : "10011", tags : [ "business", "tech" ] } Thursday, 25 October 12
  • 37. Schema Design Relational Database Thursday, 25 October 12
  • 38. Schema Design MongoDB embedding linking Thursday, 25 October 12
  • 39. Schemas in MongoDB Design documents that simply map to your application post = {author: "Hergé", date: new Date(), text: "Destination Moon", tags: ["comic", "adventure"]} > db.posts.save(post) Thursday, 25 October 12
  • 40. Embedding > db.blogs.find( { author: "Hergé"} ) { _id : ObjectId("4c4ba5c0672c685e5e8aabf3"), author : "Hergé", date : ISODate("2011-09-18T09:56:06.298Z"), text : "Destination Moon", tags : [ "comic", "adventure" ], comments : [ ! { ! ! author : "Kyle", ! ! date : ISODate("2011-09-19T09:56:06.298Z"), ! ! text : "great book" ! } ] } Thursday, 25 October 12
  • 41. JSON & Scaleout • Embedding removes need for • Distributed Joins • Two Phase commit • Enables data to be distributed across many nodes without penalty Thursday, 25 October 12
  • 46. download at mongodb.org! norberto@10gen.com Support, Training, Consulting, Events, Meetups http://www.10gen.com Facebook! Twitter! LinkedIn! http://bit.ly/mongofb! http://twitter.com/mongodb! http://linkd.in/joinmongo! Thursday, 25 October 12