mongodb 101 & beyond: get started in mongodb 3.0, preview 3.2 & demo of ops manager, muthu...
TRANSCRIPT
MongoDB 3.x & Ops Manager
Muthu ChinnasamySenior Solutions [email protected]
MongoDB is for…
Some of the Giant Ideas Using MongoDB
MongoDB Adds Business Value
Competitive Advantage Mitigating Risk
Lower TCOFaster Time to Value
Agenda
• What's new in MongoDB 3.0?• Ops manager - Automation, backup,
monitoring• What's new in version 3.2?• Q&A
What's new in MongoDB 3.0?
Pluggable Storage Engines
Pluggable Storage Engines
Content Repo
IoT Sensor Backend Ad Service Customer
Analytics Archive
MongoDB Query Language (MQL) + Native Drivers
MongoDB Document Data Model
MMAP V1 WT In-Memory ? ?
Supported in MongoDB 3.0 Future Possible Storage Engines
Man
agem
ent
Sec
urity
Example Future State
Experimental
Introducing WiredTiger
• Pluggable storage engines!• MMAPv1 (Default)• wiredTiger
Additional flag when launching 3.0.x mongod:
--storageEngine=wiredTiger
How Do I run WiredTiger?
• Cannot copy raw data files. WT will fail to start if it finds wrong data format
• Two ways to perform an engine upgrade:• Mongodump/Mongorestore• Add new replica member with WT
• You can run replicas with mixed storage engines
How Do I Upgrade to it?
• Document-level concurrency• Compression• Consistency without journaling• Better performance for write heavy
workloads• Vertically scalable as it allows full hardware
utilization• Index placement on faster storage devices
Why is WiredTiger Awesome?
mmapv1 2.6 concurrency model
Lock manager has a toll booth for each database
Reads and writes must acquire database level lock
mmapv1 3.0 concurrency model
Lock manager has a toll booth for each collection
Reads and writes must acquire collection level lock
7-10x Better Write Performance
No toll booths!Atomic update replaces latching/lockingYields on write contention to same document
Up to 80% Compression
• WiredTiger uses snappy compression by default in MongoDB
• Supported compression algorithms – snappy [default]: good compression, low overhead– zlib: better compression, more CPU– none
• Indexes are compressed using prefix compression– allows compression in RAM
500GB 100GB
Compression – mongod options
--wiredTigerCollectionBlockCompressor (=snappy)
[snappy|zlib|none]
--wiredTigerJournalCompressor (=snappy)
--wiredTigerIndexPrefixCompression (=1)
Compression – Object options
db.createCollection( "coll", {storageEngine: {wiredTiger: { configString: "block_compressor=snappy" }}})
db.coll.createIndex({a:1},{storageEngine: {wiredTiger: { configString: "block_compressor=zlib"}}})
• WiredTiger cache stores uncompressed data• Ideally, working set fits in WT cache
1. File system cache stores compressed data2. Uses higher value of 50% of RAM or 1GB
WiredTiger Cache
--wiredTigerCacheSizeGB {arg}
Ensure indexes fit in RAM
Ops Manager
How Ops Manager Helps You
Scale EasilyMeet SLAs
Best Practices, Automated
Cut Management Overhead
23
Zero Downtime Cluster UpgradesManual Steps
• Manual steps upgrading a 2.6.11 sharded cluster to 3.0.6 version, on enterprise edition, and convert the storage engine to wiredTiger
24
Upgrades, downgrades150+ steps
Example Deployment – 6 Servers
Zero Downtime Cluster UpgradesOps Manager Automation
• Using Ops Manager automation• Start with a 2.6.11 Community cluster• Upgrade to 3.0.6 Enterprise cluster• Convert storage Engine to wiredTiger
Turn long and complicated manual processes into single click operations with Ops Manager automation
Ensure availability during system upgrades
25
Summary: Benefits of MongoDB 3.0
What's new in version 3.2
New in MongoDB 3.2
MongoDB 3.2 New Features
• Fast failovers– 2-seconds election times
• Support for more than 3 data centers– Config servers as replica sets
• Cluster read-committed– readConcern: { level: <majority|local>
• WiredTiger default storage engine• Aggregation framework enhancements
– New stages $sample– New arithmetic operators & accumulators
• Mongo shell enhancements
MongoDB 3.2 – Compass
MongoDB 3.2 – Left Outer Joins• Create a new field in aggregated documents "cust_orders"
containing array of documents from "orders" collection • Similar to where "customers"."_id"="orders"."cust_id"
Db.customers.aggregate([ {
$lookUp: { from: "orders", localField: "_id", foreignField: "cust_id", as: "cust_orders" }
}])
MongoDB 3.2 – Encryption at rest
• Encryption is a database-level option– Master key & local keys allow for easier key
management and key rotation for compliance• Supports standard 3rd party key management
appliances (KMIP)• Default encryption schema is AES256-CBC
– Also have GCM• FIPS 140-2 compliant option
MongoDB 3.2 – Partial Indexes
> db.customers.createIndex({ state:1}, { partialFilterExpression: { active: {$eq : 'Y'}}}){
"createdCollectionAutomatically" : false,"numIndexesBefore" : 1,"numIndexesAfter" : 2,"ok" : 1
}Index only for docs matching the filter
expression
MongoDB 3.2 – Document Validation> db.runCommand({"collMod": 'customers', "validator" : {email: {$exists: true}}}){ "ok" : 1 }
> db.customers.insert({name:'Rose McClendon', age:27, state:'CA', city:'San Francisco', zip:94301})
WriteResult({"nInserted" : 0,"writeError" : {
"code" : 121,"errmsg" : "Document failed validation"
}})
> db.customers.insert({name:'Rose McClendon', age:27, email:'[email protected]', state:'CA', city:'San Francisco', zip:94301})WriteResult({ "nInserted" : 1 })
Enforces email field
Thank You!
Questions?