Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Best Practices for Running MongoDB on AWS - AWS May 2016 Webinar Series

5,173 views

Published on

MongoDB is an open source, NoSQL database that uses JSON-like documents with dynamic schemas. MongoDB’s ease of use makes it a very popular choice among a wide variety of applications including Ad Tech, financial services, IoT, mobile, and more. The recent releases of MongoDB 3.2 bring the benefits of modern database architectures to a growing range of applications and users.
In this webinar, we'll cover best practices for running and scaling MongoDB on AWS. Then we will show how users can spin up new clusters on AWS in minutes using MongoDB Cloud Manager. Finally, we'll discuss the necessary steps to maintain, monitor, and backup MongoDB.

Learning Objectives:
• Best practices to deploy and scale MongoDB on AWS
• Using MongoDB Cloud Manager to spin up MongoDB clusters on AWS
• How to monitor and manage MongoDB on AWS

Published in: Technology

Best Practices for Running MongoDB on AWS - AWS May 2016 Webinar Series

  1. 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Rahul Bhartia, Partner Solution Architect 24th May 2016 MongoDB on AWS An introduction and best-practices for AWS
  2. 2. MongoDB : Basics
  3. 3. Document Model RDBMS { first_name: ‘Paul’, surname: ‘Miller’, city: ‘London’, location: [45.123,47.232], cars: [ { model: ‘Bentley’, year: 1973, value: 100000, … }, { model: ‘Rolls Royce’, year: 1965, value: 330000, … } ] } MongoDB
  4. 4. Features Rich Queries Find Paul’s cars Find everybody in London with a car between 1970 and 1980 Geospatial Find all of the car owners within 5km of Trafalgar Sq. Text Search Find all the cars described as having leather seats Aggregation Calculate the average value of Paul’s car collection Map Reduce What is the ownership pattern of colors by geography over time (is purple trending in China?)
  5. 5. MongoDB: New features in 3.2
  6. 6. New Storage engines In-memory Run your most demanding, real-time apps with the in-memory storage engine (beta) Encrypted Secure your data-at-rest with the encrypted storage engine
  7. 7. Data Governance: Document Validation Implement data governance without sacrificing the agility that comes from a dynamic schema
  8. 8. Dynamic Lookup Combine data from multiple collections with left outer joins for richer analytics & more flexibility in data modeling
  9. 9. Richer In-Database Analytics & Search New Aggregation operators extend options for performing analytics with lower developer complexity Array Operators Math Operators Text $slice, $arrayElemAt, $concatArrays, $filter, $min, $max, $avg, $sum, and more. $stdDevSamp, $stdDevPop, $sqrt,$abs, $trunc, $ceil,$floor, $log, $pow $exp, and more. Case sensitive text search and support for languages such as Arabic, Farsi, Chinese, and more.
  10. 10. MongoDB Connector for BI Visualize and explore multi-structured data using SQL-based BI platforms. Connector for BI Provides Schema Translates Queries Translates Response
  11. 11. Compass: The GUI for MongoDB Visually explore your data and schema. Run ad hoc queries in seconds Make smarter decisions about indexing, document validation, and more. No command line needed
  12. 12. MongoDB: High Availability & Scalability
  13. 13. Replica Sets Replica set – 2 to 50 copies Replica sets make up a self-healing ‘shard’ Replica sets address - High availability, Maintenance (e.g., HW swaps) and Disaster Recovery Application Driver Primary Secondary Secondary Replication
  14. 14. Replica Sets – Workload Isolation Replica sets enable workload isolation Example: Operational workloads on the primary node, analytical workloads on the secondary nodes Application Primary In-memory Secondary WiredTiger User Data Sessions, Cart, Recommendations Secondary WiredTiger Persisted User Data
  15. 15. Elastic Scalability: Automatic Sharding Increase or decrease capacity as you go Automatic load balancing Three types of sharding - Hash-based, Range- based and Tag-aware Shard 1 Shard 2 Shard 3 Shard N Horizontally Scalable
  16. 16. Query Routing Multiple query optimization models Each of the sharding options are appropriate for different apps / use cases
  17. 17. MongoDB: AWS Deployment Architectures
  18. 18. AWS EC2 Instance Types  General Purpose - M3, M4 • Start with General Purpose instances and EBS GP2  Compute-optimized - C3, C4 • WiredTiger - Write performance due to document-level concurrency control  Memory-optimized - R3 • In memory storage engine: NEW! • Larger working set - MMAPv1 with read-intensive applications  Storage-optimized - I2, D2 • Local instance store but lost when instance is stopped or terminated • Always use with higher replication https://docs.mongodb.com/ecosystem/platforms/amazon-ec2/#deployment-notes
  19. 19. Amazon EBS Volumes  EBS GP2 for general workloads and EBS PIOS for consistent performance https://docs.mongodb.com/ecosystem/platforms/amazon-ec2/#storage- considerations  EBS-optimized Instances provides additional/dedicated bandwidth http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html  EBS snapshots for recovery and backups https://docs.mongodb.com/ecosystem/platforms/amazon-ec2/#backup-restore- verify
  20. 20. AWS Global Footprint
  21. 21. High Availability: Intra-Region
  22. 22. High Availability: Intra-Region
  23. 23. High Availability: Inter-Region
  24. 24. Disaster Recovery: Inter-Region
  25. 25. Disaster Recovery: Inter-Region
  26. 26. Go global Deploy Global, Access Local Replicate Data Near Users
  27. 27. MongoDB - Management
  28. 28. The Best Way to Run MongoDB Ops Manager and Cloud Manager allows you leverage and automate the best practices. 10x-20x more efficient operations Complete performance visibility Protection from data loss Performance optimization
  29. 29. How they work Ops or Cloud Manager mongod mongodmongod Agent Agent Agent
  30. 30. Amazon QuickStart https://aws.amazon.com/quickstart/ VPC with private and public subnets Instance role with fine-grained permissions. Security groups A fully customized MongoDB cluster - Replica sets, shards, and config servers and customized EBS storage
  31. 31. Monitoring & Alerting Over 100+ database-related metrics Dozens of optimized charts Custom alerts so incidents do not become emergencies
  32. 32. Do-It-Yourself Set of utilities distributed with MongoDB – mongostat, mongotop Database commands – serverStatus, dbStats, collStats etc Self-hosted – Ganglia, mtop, munin, nagios Hosted (SaaS) – New Relic, Datadog, Server Density https://docs.mongodb.com/manual/administration/monitoring/
  33. 33. Backup with Point-in-time Recovery Cluster-wide snapshots of sharded clusters Restore to precisely the moment you need, quickly and safely with point-in- time restores
  34. 34. Manual Backup Considerations  Consider a hidden member in a Replica set  Consider EBS Snapshots  Consider Journaling (Write Ahead Log), and allow for DB durability in case of a fault  Ensure consistency by using db.fsyncLock() https://docs.mongodb.com/ecosystem/tutorial/backup-and-restore- mongodb-on-amazon-ec2/
  35. 35. Visual Query Profiler Identify the slow-running queries across your cluster with just the click of a button Index suggestions to improve your query performance Automate rolling index builds to reduce operational overhead and the risk of failovers
  36. 36. Resources MongoDB on AWS best practices: http://docs.mongodb.org/ecosystem/platforms/amazo n-ec2/ MongoDB production Notes http://docs.mongodb.org/manual/administration/produ ction-notes/ MongoDB Documentation http://docs.mongodb.org
  37. 37. Thank you!

×