My First Moments with
MongoDB
Colin Charles
byte@bytebot.net | @bytebot | http://bytebot.net/blog/
Community Open House, New York City, New York, USA
30 June 2016
whoami
• Work on MariaDB Server at MariaDB Corporation
(SkySQL Ab)
• Merged with Monty Program Ab, makers of MariaDB
• Formerly MySQL AB (exit: Sun Microsystems)
• Past lives include Fedora Project (FESCO),
OpenOffice.org
• MySQL Community Contributor of the Year Award
winner 2014
Agenda
• What is MongoDB?
• Why MongoDB?
• Who uses MongoDB?
• Where is MongoDB
found?
• Storage Engines
• Distributions
• Replication
• Backups
• Monitoring
• DBaaS
• Production
• Resources
Research Papers
• 1970 E.F. Codd paper “A Relational Model of Data for Large
Shared Data Banks”
• 2004 Google paper “MapReduce: Simplified Data Processing on
Large Clusters” -> Hadoop ~2008 “big data movement”
• 2006 Google paper “BigTable: A Distributed Storage System for
Structured Data” -> Cassandra/HBase/LevelDB ~2009
• 2007 Amazon paper “Dynamo: Amazon’s Highly Available Key-
value Store” -> Aerospike/Cassandra/Voldemort/Riak
• 2012 Google paper “Spanner: Google’s Globally-Distributed
Database” -> CockroachDB
What is MongoDB?
• Document oriented database
• data stored in documents, not tables/relations
• JSON
• JavaScript
• Flexible schema
• no downtime for field (column) changes or index
creation
Why MongoDB?
• “After three years it has become clear that in
terms of LinkedIn member profiles there is only
one trend: the total dominance of MongoDB.” -
Matt Aslett, 451 Group
• Agile development
• No additional caching layer required
• Built in replication with automatic failover +
sharding out of the box
Who uses MongoDB?
• Craigslist
• Facebook’s Parse
• Business Insider
• Foursquare
• Stripe
Where is MongoDB found?
• All manner of Linux distributions
• MongoDB repositories: http://repo.mongodb.org/
• Works on Little Endian only (SERVER-1625)
• Test databases (mongoimport)
• http://media.mongodb.org/zips.json
• https://docs.mongodb.com/getting-started/shell/import-data/
(primer-dataset.json restaurants)
• https://docs.mongodb.com/manual/reference/program/
Storage Engines
• MMAPv1 (B-Tree)
• WiredTiger (B-Tree, LSM)
• MongoRocks (LSM)
• (PerconaFT, formerly TokuMX/TokuKV)
• In-memory engine (Enterprise)
Distributions of MongoDB
• MongoDB
• MongoDB Enterprise
• Percona Server for MongoDB
• MongoRocks, audit logging, SASL
authentication,
Replication
• Node: single mongod process
• Majority
• Replica set: group of nodes. HA via elections. All
members are equal by default + replicate to
each other asynchronously
• Oplog: capped collection, idempotent
Replication II
• Shard: replica sets are groups. Queries filtered
for data chunk holds
• Config servers: metadata for sharded clusters
Backups
• mongodump / mongorestore
• filesystem snapshots (LVM)
• rocks-strata (MongoRocks); TokuBackup
(PerconaFT)
• $: Ops Manager / Cloud Manager
Monitoring
• mongostat
• mongotop
• db.serverStatus(), etc.
• host of OSS tools
• $aa$: Cloud Manager, New Relic, DataDog
DBaaS
• mLab
• ObjectRocket
• Compose
• MongoDB Atlas
Production Notes
• Configure mongod.conf!
• Follow through and you’ll be off to a good start
• https://docs.mongodb.com/manual/
administration/production-notes/
• https://docs.mongodb.com/manual/
administration/production-checklist/
There’s more
• Understanding aggregation framework
• Sizing and provisioning
• db.collection.stats(), .explain()
• GIS functionality
• Grants? There are roles in MongoDB!
• Percona Toolkit? mlogsummary, mongo-summary
Books
Resources
• MongoDB University - https://
university.mongodb.com/
• Quick Reference Cards - https://
www.mongodb.com/collateral/quick-reference-
cards
• The Little MongoDB Book (2.6) - https://
github.com/karlseguin/the-little-mongodb-book/
blob/master/en/mongodb.markdown
Thank You!
byte@bytebot.net | @bytebot | http://bytebot.net/blog/
slides: slideshare.net/bytebot

My first moments with MongoDB

  • 1.
    My First Momentswith MongoDB Colin Charles byte@bytebot.net | @bytebot | http://bytebot.net/blog/ Community Open House, New York City, New York, USA 30 June 2016
  • 2.
    whoami • Work onMariaDB Server at MariaDB Corporation (SkySQL Ab) • Merged with Monty Program Ab, makers of MariaDB • Formerly MySQL AB (exit: Sun Microsystems) • Past lives include Fedora Project (FESCO), OpenOffice.org • MySQL Community Contributor of the Year Award winner 2014
  • 3.
    Agenda • What isMongoDB? • Why MongoDB? • Who uses MongoDB? • Where is MongoDB found? • Storage Engines • Distributions • Replication • Backups • Monitoring • DBaaS • Production • Resources
  • 4.
    Research Papers • 1970E.F. Codd paper “A Relational Model of Data for Large Shared Data Banks” • 2004 Google paper “MapReduce: Simplified Data Processing on Large Clusters” -> Hadoop ~2008 “big data movement” • 2006 Google paper “BigTable: A Distributed Storage System for Structured Data” -> Cassandra/HBase/LevelDB ~2009 • 2007 Amazon paper “Dynamo: Amazon’s Highly Available Key- value Store” -> Aerospike/Cassandra/Voldemort/Riak • 2012 Google paper “Spanner: Google’s Globally-Distributed Database” -> CockroachDB
  • 5.
    What is MongoDB? •Document oriented database • data stored in documents, not tables/relations • JSON • JavaScript • Flexible schema • no downtime for field (column) changes or index creation
  • 6.
    Why MongoDB? • “Afterthree years it has become clear that in terms of LinkedIn member profiles there is only one trend: the total dominance of MongoDB.” - Matt Aslett, 451 Group • Agile development • No additional caching layer required • Built in replication with automatic failover + sharding out of the box
  • 7.
    Who uses MongoDB? •Craigslist • Facebook’s Parse • Business Insider • Foursquare • Stripe
  • 8.
    Where is MongoDBfound? • All manner of Linux distributions • MongoDB repositories: http://repo.mongodb.org/ • Works on Little Endian only (SERVER-1625) • Test databases (mongoimport) • http://media.mongodb.org/zips.json • https://docs.mongodb.com/getting-started/shell/import-data/ (primer-dataset.json restaurants) • https://docs.mongodb.com/manual/reference/program/
  • 9.
    Storage Engines • MMAPv1(B-Tree) • WiredTiger (B-Tree, LSM) • MongoRocks (LSM) • (PerconaFT, formerly TokuMX/TokuKV) • In-memory engine (Enterprise)
  • 10.
    Distributions of MongoDB •MongoDB • MongoDB Enterprise • Percona Server for MongoDB • MongoRocks, audit logging, SASL authentication,
  • 11.
    Replication • Node: singlemongod process • Majority • Replica set: group of nodes. HA via elections. All members are equal by default + replicate to each other asynchronously • Oplog: capped collection, idempotent
  • 12.
    Replication II • Shard:replica sets are groups. Queries filtered for data chunk holds • Config servers: metadata for sharded clusters
  • 13.
    Backups • mongodump /mongorestore • filesystem snapshots (LVM) • rocks-strata (MongoRocks); TokuBackup (PerconaFT) • $: Ops Manager / Cloud Manager
  • 14.
    Monitoring • mongostat • mongotop •db.serverStatus(), etc. • host of OSS tools • $aa$: Cloud Manager, New Relic, DataDog
  • 15.
    DBaaS • mLab • ObjectRocket •Compose • MongoDB Atlas
  • 16.
    Production Notes • Configuremongod.conf! • Follow through and you’ll be off to a good start • https://docs.mongodb.com/manual/ administration/production-notes/ • https://docs.mongodb.com/manual/ administration/production-checklist/
  • 17.
    There’s more • Understandingaggregation framework • Sizing and provisioning • db.collection.stats(), .explain() • GIS functionality • Grants? There are roles in MongoDB! • Percona Toolkit? mlogsummary, mongo-summary
  • 18.
  • 19.
    Resources • MongoDB University- https:// university.mongodb.com/ • Quick Reference Cards - https:// www.mongodb.com/collateral/quick-reference- cards • The Little MongoDB Book (2.6) - https:// github.com/karlseguin/the-little-mongodb-book/ blob/master/en/mongodb.markdown
  • 20.
    Thank You! byte@bytebot.net |@bytebot | http://bytebot.net/blog/ slides: slideshare.net/bytebot