SlideShare ist ein Scribd-Unternehmen logo
1 von 44
StudyBlue




Introduction to MongoDB
Sean Laurent




April 16, 2012




StudyBlue, Inc.
Overview


  •      NoSQL landscape

  •      MongoDB features

  •      Availability & Scalability

  •      Useful Tools

  •      Strengths & Weaknesses




StudyBlue, Inc.
Who am I?


  •      Sean Laurent

  •      sean@studyblue.com

  •      Director of Operations at StudyBlue, Inc.




StudyBlue, Inc.
studyblue.com



StudyBlue, Inc.
About StudyBlue

  •     Bottom-up attempt to improve student
        outcomes


  •     Online service for storing, studying, sharing
        and ultimately mastering course material


  •     Digital backpack for students




StudyBlue, Inc.
StudyBlue Usage

  •     Many simultaneous users


  •     Rapid growth


  •     Cyclical usage




StudyBlue, Inc.
NoSQL Landscape:
Database Models


StudyBlue, Inc.
Database Models




StudyBlue, Inc.
NoSQL Data Models

  •     Key-Value stores


  •     Document stores


  •     Column-oriented databases


  •     Graph databases




StudyBlue, Inc.
Key-Value Stores

  •     Maps keys to values


  •     Operations:

       •     Get, Set and Delete


  •     Examples:

       •     Cassandra, Project Voldemort, memcache, Redis




StudyBlue, Inc.
Document Stores

  •     Contains “documents”

       •     Documents have “fields”


  •     Secondary indexes


  •     Operations:

       •     Insert, Update, Delete, Update fields


  •     Examples:

       •     MongoDB, CouchDB




StudyBlue, Inc.
Column Oriented Databases

  •     Reversed relational database

       •     Data for column kept together


  •     Operations:

       •     Insert, Update, Delete; update fields


  •     Examples:

       •     BigTable, HBase, CStore, Greenplum




StudyBlue, Inc.
Graph Databases

  •     Stores edges between nodes


  •     Operations:

       •     Getting/Setting edges


            •     Annotate vertices or edges


       •     Query for paths


  •     Examples:

       •     GraphBase, Neo4j, VertexDB




StudyBlue, Inc.
MongoDB:
Features


StudyBlue, Inc.
Document Oriented

  •     System holds databases


  •     A database holds collections


  •     A collection holds documents


  •     A document is a set of fields written in JSON


  •     A field is key-value pair


  •     A key is a string


  •     A value is a basic type, an array or another document


StudyBlue, Inc.
Sample Document

    {
        “author” : “sean”,
        “title” : “Intro to MongoDB”,
        “tags” : [ “mongodb”, “introduction” ],
        “views” : 42,
        “comments” : [
          {
             “author” : “bob”,
             “comment” : “Best presentation EVER!”
          },
          {
             “author” : “tom”,
             “comment” : “Way too long winded.”
          }
        ]
    }


StudyBlue, Inc.
Flexible Schemas

•   Different documents in one collection can have different fields:

    {
        “author” : “sean”,
        “title” : “Intro to MongoDB”
    }




    {
        “author” : “sean”,
        “title” : “Databases At Scale”,
        “tags” : [ “mongodb”, “scaling” ]
    }



StudyBlue, Inc.
Query Features

  •     No joins


  •     No transactions across documents or collections


  •     Atomic updates


  •     Simple query syntax




StudyBlue, Inc.
Query Examples

    db.posts.find({author: ‘sean’})


    db.posts.find({author: ‘sean’}).sort({timestamp: 1})


    db.posts.find({author: ‘sean’}).sort({timestamp: 1}).limit(2)


    db.posts.find({author: ‘sean’, tags: ‘mongodb’})


    db.posts.find({author: ‘sean’, tags: {$in: [‘mongodb’, ‘intro’]}})


    db.posts.find({author: ‘sean’, views: {$gt: 10}})


    db.posts.find({$or: [{author: ‘sean’}, {views: ${gt: 20}]})


    db.posts.find({}, {author: 1, views: 1})


StudyBlue, Inc.
Update Examples

    db.posts.update({author: ‘sean’}, { $incr: {views: 1}})


    db.posts.update({author: ‘sean’}, { $set: {views: 350}})


    db.posts.update({author: ‘sean’}, { $push: {tags: ‘awesome’}})


    db.posts.update({author: ‘sean’}, { $set: {views: 350}}, /* upsert
    */ true)


    db.posts.update({author: ‘sean’}, { $incr: {views: 1}}, /* upsert */
    false, /* multi */ true)




StudyBlue, Inc.
Indexes

  •     B-Tree indexes


  •     Embedded fields


  •     Compound keys


  •     Sparse


  •     Unique


  •     v2.1.0 or later support background indexing




StudyBlue, Inc.
Official Drivers

  •      C

  •      C++

  •      Erlang

  •      Haskell

  •      Java

  •      Javascript

  •      .NET (C#, F#, PowerShell)

  •      Perl

  •      PHP

  •      Python

  •      Ruby

  •      Scala

StudyBlue, Inc.
Community Supported Drivers

  •      ActionScript 3

  •      Clojure

  •      Dart

  •      Go

  •      Groovy

  •      node.js

  •      Objective C

  •      Rails 3

  •      ...




StudyBlue, Inc.
Other Cool Stuff

  •     Aggregation


  •     Explain


  •     Map Reduce


  •     Capped collections


  •     GridFS


  •     Geospatial indexing




StudyBlue, Inc.
MongoDB:
Availability &
Scalability


StudyBlue, Inc.
Replication

  •     Replica sets

       •     Asynchronous master/slave replication


       •     Consists of two or more nodes that are copies of each other


       •     Eventual consistency


  •     Automatic failover

       •     Automatically elects a primary (aka master)


  •     Automatic recovery



StudyBlue, Inc.
Replica Set Benefits


  •      Redundancy / Disaster Recovery

  •      Automated failover

  •      Read scaling

  •      Maintenance




StudyBlue, Inc.
Replica Set - Read Scaling




StudyBlue, Inc.
Replica Set Elections


  •      Consensus Vote

       •      Arbiters


  •      Priorities

       •      By default, all nodes have equal priority

       •      Assign custom priorities for more powerful machines or specific datacenters

       •      Highest priority amongst the most up-to-date nodes will be elected




StudyBlue, Inc.
Sharding

  •     Horizontal scaling (write scaling)


  •     Automatic data partitioning & balancing


  •     Automatic query routing


  •     Each shard is typically a replica set


  •     Sharding is enabled per collection




StudyBlue, Inc.
Shards

  •     Shard keys define partitions

       •     Names one or more fields that determine how the data is distributed


       •     Order preserving - adjacent data (by key) tend to be stored on the same server


  •     Chunks

       •     Contiguous range of data from a particular collection


       •     Chunks grow to a maximum size, then split into two new chunks


       •     Automatically migrates chunks when chunk count is sufficiently imbalanced between
             different shards




StudyBlue, Inc.
Sharding Architecture




StudyBlue, Inc.
Sharding Pieces


  •      Config servers (mongoc)

       •      Stores cluster metadata

       •      Data about each shard and the chunks on that shard

       •      Two-phased commits


  •      Routing servers (mongos)

       •      Receives client requests and routes to appropriate server(s)

       •      Pulls state from config servers

       •      Lightweight - run anywhere (including application servers)




StudyBlue, Inc.
MongoDB:
Tools


StudyBlue, Inc.
Useful Tools

  •     mongo shell


  •     mongostat


  •     mongotop


  •     Mongo Monitoring Service (MMS)




StudyBlue, Inc.
mongo shell


•    Interactive Javascript shell

•    Part of the MongoDB installation

•    Issue commands & queries:

     ./bin/mongo mydatabase
     type “help” for help
     > db
     mydatabase

     > person = db.people.findOne( { name : "sara" } );
     > person.city = "New York";
     > db.people.save( person );




StudyBlue, Inc.
mongostat

•   View statistics on a running mongod instance




StudyBlue, Inc.
mongotop

•   Track the amount of time a MongoDB instance spends reading and
    writing data on a per collection basis




StudyBlue, Inc.
MMS


  •      Free, cloud-based monitoring service

  •      Charts

  •      Dashboards

  •      Automated alerting

  •      http://mms.10gen.com




StudyBlue, Inc.
MongoDB:
Strengths &
Weaknesses


StudyBlue, Inc.
Good At


  •      Horizontal scaling

  •      High availability

  •      Rapidly evolving schemas




StudyBlue, Inc.
Less Good At


  •      Drop-in replacement for existing SQL RDBMS

  •      Highly transactional operations (e.g. OLTP)

  •      Ad-hoc business intelligence

  •      Durability without replica sets

  •      Automatic sharding != perfect data distribution




StudyBlue, Inc.
Q&A



StudyBlue, Inc.
Contact us
Web: http://www.studyblue.com
Twitter: @StudyBlue

Email: sean@studyblue.com
Twitter: @organicveggie



   StudyBlue, Inc.

Weitere ähnliche Inhalte

Was ist angesagt?

MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at ScaleMongoDB
 
Hadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerHadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerIke Ellis
 
Dissecting Scalable Database Architectures
Dissecting Scalable Database ArchitecturesDissecting Scalable Database Architectures
Dissecting Scalable Database Architectureshypertable
 
Challenges with MongoDB
Challenges with MongoDBChallenges with MongoDB
Challenges with MongoDBStone Gao
 
Papers We Love Too, June 2015: Haystack
Papers We Love Too, June 2015: Haystack Papers We Love Too, June 2015: Haystack
Papers We Love Too, June 2015: Haystack Sargun Dhillon
 
Postgres NoSQL - Delivering Apps Faster
Postgres NoSQL - Delivering Apps FasterPostgres NoSQL - Delivering Apps Faster
Postgres NoSQL - Delivering Apps FasterEDB
 
Study Notes: Facebook Haystack
Study Notes: Facebook HaystackStudy Notes: Facebook Haystack
Study Notes: Facebook HaystackGao Yunzhong
 
Divide and conquer in the cloud
Divide and conquer in the cloudDivide and conquer in the cloud
Divide and conquer in the cloudJustin Swanhart
 
Where Is My Data - ILTAM Session
Where Is My Data - ILTAM SessionWhere Is My Data - ILTAM Session
Where Is My Data - ILTAM SessionTamir Dresher
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at LocalyticsOptimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localyticsandrew311
 
Everything You Need for a Viral Game (Except the Game)
Everything You Need for a Viral Game (Except the Game)Everything You Need for a Viral Game (Except the Game)
Everything You Need for a Viral Game (Except the Game)Amazon Web Services
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101MongoDB
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity PlanningNorberto Leite
 
Webinar: Scaling MongoDB
Webinar: Scaling MongoDBWebinar: Scaling MongoDB
Webinar: Scaling MongoDBMongoDB
 
Mongodb - Scaling write performance
Mongodb - Scaling write performanceMongodb - Scaling write performance
Mongodb - Scaling write performanceDaum DNA
 
Power BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudPower BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudKellyn Pot'Vin-Gorman
 
Managing multi tenant resource toward Hive 2.0
Managing multi tenant resource toward Hive 2.0Managing multi tenant resource toward Hive 2.0
Managing multi tenant resource toward Hive 2.0Kai Sasaki
 
Azure Storage Performance
Azure Storage PerformanceAzure Storage Performance
Azure Storage PerformanceAnton Boyko
 

Was ist angesagt? (20)

MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at Scale
 
Hadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerHadoop for the Absolute Beginner
Hadoop for the Absolute Beginner
 
Dissecting Scalable Database Architectures
Dissecting Scalable Database ArchitecturesDissecting Scalable Database Architectures
Dissecting Scalable Database Architectures
 
No sq lv1_0
No sq lv1_0No sq lv1_0
No sq lv1_0
 
Challenges with MongoDB
Challenges with MongoDBChallenges with MongoDB
Challenges with MongoDB
 
Papers We Love Too, June 2015: Haystack
Papers We Love Too, June 2015: Haystack Papers We Love Too, June 2015: Haystack
Papers We Love Too, June 2015: Haystack
 
Postgres NoSQL - Delivering Apps Faster
Postgres NoSQL - Delivering Apps FasterPostgres NoSQL - Delivering Apps Faster
Postgres NoSQL - Delivering Apps Faster
 
Study Notes: Facebook Haystack
Study Notes: Facebook HaystackStudy Notes: Facebook Haystack
Study Notes: Facebook Haystack
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Divide and conquer in the cloud
Divide and conquer in the cloudDivide and conquer in the cloud
Divide and conquer in the cloud
 
Where Is My Data - ILTAM Session
Where Is My Data - ILTAM SessionWhere Is My Data - ILTAM Session
Where Is My Data - ILTAM Session
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at LocalyticsOptimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
 
Everything You Need for a Viral Game (Except the Game)
Everything You Need for a Viral Game (Except the Game)Everything You Need for a Viral Game (Except the Game)
Everything You Need for a Viral Game (Except the Game)
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity Planning
 
Webinar: Scaling MongoDB
Webinar: Scaling MongoDBWebinar: Scaling MongoDB
Webinar: Scaling MongoDB
 
Mongodb - Scaling write performance
Mongodb - Scaling write performanceMongodb - Scaling write performance
Mongodb - Scaling write performance
 
Power BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle CloudPower BI with Essbase in the Oracle Cloud
Power BI with Essbase in the Oracle Cloud
 
Managing multi tenant resource toward Hive 2.0
Managing multi tenant resource toward Hive 2.0Managing multi tenant resource toward Hive 2.0
Managing multi tenant resource toward Hive 2.0
 
Azure Storage Performance
Azure Storage PerformanceAzure Storage Performance
Azure Storage Performance
 

Andere mochten auch

Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellScott Hernandez
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)MongoSF
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDBMongoDB
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012Chris Westin
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBKnoldus Inc.
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDBSkills Matter
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDBPankaj Bajaj
 
An Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteAn Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteMongoDB
 
Zero to Mongo in 60 Hours
Zero to Mongo in 60 HoursZero to Mongo in 60 Hours
Zero to Mongo in 60 HoursMongoSF
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewNorberto Leite
 
Mongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsMongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsJAX London
 
Text databases and information retrieval
Text databases and information retrievalText databases and information retrieval
Text databases and information retrievalunyil96
 

Andere mochten auch (20)

MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript Shell
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)
 
Intro to NoSQL and MongoDB
 Intro to NoSQL and MongoDB Intro to NoSQL and MongoDB
Intro to NoSQL and MongoDB
 
mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012mongodb-brief-intro-february-2012
mongodb-brief-intro-february-2012
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Seth Edwards on MongoDB
Seth Edwards on MongoDBSeth Edwards on MongoDB
Seth Edwards on MongoDB
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
 
An Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and KeynoteAn Evening with MongoDB - Orlando: Welcome and Keynote
An Evening with MongoDB - Orlando: Welcome and Keynote
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Plan de entrenamiento Maratón de Madrid Mes 3
Plan de entrenamiento Maratón de Madrid Mes 3Plan de entrenamiento Maratón de Madrid Mes 3
Plan de entrenamiento Maratón de Madrid Mes 3
 
Mongo db intro new
Mongo db intro newMongo db intro new
Mongo db intro new
 
Zero to Mongo in 60 Hours
Zero to Mongo in 60 HoursZero to Mongo in 60 Hours
Zero to Mongo in 60 Hours
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature Preview
 
Mongodb
MongodbMongodb
Mongodb
 
Mongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdamsMongo DB on the JVM - Brendan McAdams
Mongo DB on the JVM - Brendan McAdams
 
Text databases and information retrieval
Text databases and information retrievalText databases and information retrieval
Text databases and information retrieval
 

Ähnlich wie Introduction to MongoDB

Ähnlich wie Introduction to MongoDB (20)

MongoDB
MongoDBMongoDB
MongoDB
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
 
No sql Database
No sql DatabaseNo sql Database
No sql Database
 
MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behl
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
MongoDB
MongoDBMongoDB
MongoDB
 
Modeling Data in MongoDB
Modeling Data in MongoDBModeling Data in MongoDB
Modeling Data in MongoDB
 
No SQL : Which way to go? Presented at DDDMelbourne 2015
No SQL : Which way to go?  Presented at DDDMelbourne 2015No SQL : Which way to go?  Presented at DDDMelbourne 2015
No SQL : Which way to go? Presented at DDDMelbourne 2015
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
Drop acid
Drop acidDrop acid
Drop acid
 
Mongodb my
Mongodb myMongodb my
Mongodb my
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
SDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and modelsSDEC2011 NoSQL concepts and models
SDEC2011 NoSQL concepts and models
 
Mongo db eveningschemadesign
Mongo db eveningschemadesignMongo db eveningschemadesign
Mongo db eveningschemadesign
 
Mongodb lab
Mongodb labMongodb lab
Mongodb lab
 
Sharing a Startup’s Big Data Lessons
Sharing a Startup’s Big Data LessonsSharing a Startup’s Big Data Lessons
Sharing a Startup’s Big Data Lessons
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
 

Kürzlich hochgeladen

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Kürzlich hochgeladen (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Introduction to MongoDB

  • 1. StudyBlue Introduction to MongoDB Sean Laurent April 16, 2012 StudyBlue, Inc.
  • 2. Overview • NoSQL landscape • MongoDB features • Availability & Scalability • Useful Tools • Strengths & Weaknesses StudyBlue, Inc.
  • 3. Who am I? • Sean Laurent • sean@studyblue.com • Director of Operations at StudyBlue, Inc. StudyBlue, Inc.
  • 5. About StudyBlue • Bottom-up attempt to improve student outcomes • Online service for storing, studying, sharing and ultimately mastering course material • Digital backpack for students StudyBlue, Inc.
  • 6. StudyBlue Usage • Many simultaneous users • Rapid growth • Cyclical usage StudyBlue, Inc.
  • 9. NoSQL Data Models • Key-Value stores • Document stores • Column-oriented databases • Graph databases StudyBlue, Inc.
  • 10. Key-Value Stores • Maps keys to values • Operations: • Get, Set and Delete • Examples: • Cassandra, Project Voldemort, memcache, Redis StudyBlue, Inc.
  • 11. Document Stores • Contains “documents” • Documents have “fields” • Secondary indexes • Operations: • Insert, Update, Delete, Update fields • Examples: • MongoDB, CouchDB StudyBlue, Inc.
  • 12. Column Oriented Databases • Reversed relational database • Data for column kept together • Operations: • Insert, Update, Delete; update fields • Examples: • BigTable, HBase, CStore, Greenplum StudyBlue, Inc.
  • 13. Graph Databases • Stores edges between nodes • Operations: • Getting/Setting edges • Annotate vertices or edges • Query for paths • Examples: • GraphBase, Neo4j, VertexDB StudyBlue, Inc.
  • 15. Document Oriented • System holds databases • A database holds collections • A collection holds documents • A document is a set of fields written in JSON • A field is key-value pair • A key is a string • A value is a basic type, an array or another document StudyBlue, Inc.
  • 16. Sample Document { “author” : “sean”, “title” : “Intro to MongoDB”, “tags” : [ “mongodb”, “introduction” ], “views” : 42, “comments” : [ { “author” : “bob”, “comment” : “Best presentation EVER!” }, { “author” : “tom”, “comment” : “Way too long winded.” } ] } StudyBlue, Inc.
  • 17. Flexible Schemas • Different documents in one collection can have different fields: { “author” : “sean”, “title” : “Intro to MongoDB” } { “author” : “sean”, “title” : “Databases At Scale”, “tags” : [ “mongodb”, “scaling” ] } StudyBlue, Inc.
  • 18. Query Features • No joins • No transactions across documents or collections • Atomic updates • Simple query syntax StudyBlue, Inc.
  • 19. Query Examples db.posts.find({author: ‘sean’}) db.posts.find({author: ‘sean’}).sort({timestamp: 1}) db.posts.find({author: ‘sean’}).sort({timestamp: 1}).limit(2) db.posts.find({author: ‘sean’, tags: ‘mongodb’}) db.posts.find({author: ‘sean’, tags: {$in: [‘mongodb’, ‘intro’]}}) db.posts.find({author: ‘sean’, views: {$gt: 10}}) db.posts.find({$or: [{author: ‘sean’}, {views: ${gt: 20}]}) db.posts.find({}, {author: 1, views: 1}) StudyBlue, Inc.
  • 20. Update Examples db.posts.update({author: ‘sean’}, { $incr: {views: 1}}) db.posts.update({author: ‘sean’}, { $set: {views: 350}}) db.posts.update({author: ‘sean’}, { $push: {tags: ‘awesome’}}) db.posts.update({author: ‘sean’}, { $set: {views: 350}}, /* upsert */ true) db.posts.update({author: ‘sean’}, { $incr: {views: 1}}, /* upsert */ false, /* multi */ true) StudyBlue, Inc.
  • 21. Indexes • B-Tree indexes • Embedded fields • Compound keys • Sparse • Unique • v2.1.0 or later support background indexing StudyBlue, Inc.
  • 22. Official Drivers • C • C++ • Erlang • Haskell • Java • Javascript • .NET (C#, F#, PowerShell) • Perl • PHP • Python • Ruby • Scala StudyBlue, Inc.
  • 23. Community Supported Drivers • ActionScript 3 • Clojure • Dart • Go • Groovy • node.js • Objective C • Rails 3 • ... StudyBlue, Inc.
  • 24. Other Cool Stuff • Aggregation • Explain • Map Reduce • Capped collections • GridFS • Geospatial indexing StudyBlue, Inc.
  • 26. Replication • Replica sets • Asynchronous master/slave replication • Consists of two or more nodes that are copies of each other • Eventual consistency • Automatic failover • Automatically elects a primary (aka master) • Automatic recovery StudyBlue, Inc.
  • 27. Replica Set Benefits • Redundancy / Disaster Recovery • Automated failover • Read scaling • Maintenance StudyBlue, Inc.
  • 28. Replica Set - Read Scaling StudyBlue, Inc.
  • 29. Replica Set Elections • Consensus Vote • Arbiters • Priorities • By default, all nodes have equal priority • Assign custom priorities for more powerful machines or specific datacenters • Highest priority amongst the most up-to-date nodes will be elected StudyBlue, Inc.
  • 30. Sharding • Horizontal scaling (write scaling) • Automatic data partitioning & balancing • Automatic query routing • Each shard is typically a replica set • Sharding is enabled per collection StudyBlue, Inc.
  • 31. Shards • Shard keys define partitions • Names one or more fields that determine how the data is distributed • Order preserving - adjacent data (by key) tend to be stored on the same server • Chunks • Contiguous range of data from a particular collection • Chunks grow to a maximum size, then split into two new chunks • Automatically migrates chunks when chunk count is sufficiently imbalanced between different shards StudyBlue, Inc.
  • 33. Sharding Pieces • Config servers (mongoc) • Stores cluster metadata • Data about each shard and the chunks on that shard • Two-phased commits • Routing servers (mongos) • Receives client requests and routes to appropriate server(s) • Pulls state from config servers • Lightweight - run anywhere (including application servers) StudyBlue, Inc.
  • 35. Useful Tools • mongo shell • mongostat • mongotop • Mongo Monitoring Service (MMS) StudyBlue, Inc.
  • 36. mongo shell • Interactive Javascript shell • Part of the MongoDB installation • Issue commands & queries: ./bin/mongo mydatabase type “help” for help > db mydatabase > person = db.people.findOne( { name : "sara" } ); > person.city = "New York"; > db.people.save( person ); StudyBlue, Inc.
  • 37. mongostat • View statistics on a running mongod instance StudyBlue, Inc.
  • 38. mongotop • Track the amount of time a MongoDB instance spends reading and writing data on a per collection basis StudyBlue, Inc.
  • 39. MMS • Free, cloud-based monitoring service • Charts • Dashboards • Automated alerting • http://mms.10gen.com StudyBlue, Inc.
  • 41. Good At • Horizontal scaling • High availability • Rapidly evolving schemas StudyBlue, Inc.
  • 42. Less Good At • Drop-in replacement for existing SQL RDBMS • Highly transactional operations (e.g. OLTP) • Ad-hoc business intelligence • Durability without replica sets • Automatic sharding != perfect data distribution StudyBlue, Inc.
  • 44. Contact us Web: http://www.studyblue.com Twitter: @StudyBlue Email: sean@studyblue.com Twitter: @organicveggie StudyBlue, Inc.

Hinweis der Redaktion

  1. \n
  2. \n
  3. - Developer at heart\n- 15 years experience\n- Responsible for selecting Mongo\n\n
  4. \n
  5. - Bottom-up attempt to improve student outcomes through disruptive change outside of the education system. \n- Allows students to create and store lecture notes and flashcards and access them online and via mobile apps (iOS and Android)\n
  6. - No public numbers\n- Thousands of simultaneous users at peak\n
  7. \n
  8. \n
  9. Also called “non-relational databases”\n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. update() defaults to updating ~only~ the first matching document unless “multi” is set to true.\n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n