Published on February 26, 2014
#mongodb MongoDB and AWS Part 1: Deployment and Availability Sandeep Parikh Senior Solutions Architect, MongoDB Inc.
Agenda • MongoDB Basics • Deployment Configurations • AWS EC2 Instances • Configuring Instances • Next Steps
MongoDB Basics • Open source • Document database • High performance • Horizontally scalable • Full featured • Built to match agile development and deployment
MongoDB Features • Flexible document data model • Rich ad-hoc queries and in-place updates • Real-time aggregation • Geospatial support • Text search • Built-in support for – Redundancy, failover, auto-partitioning
Deploying MongoDB • Single node – Development: prototyping, testing • Replica Set – Production: high availability, disaster recovery • Sharding – Production: auto-paritioning, linear read/write scale
MongoDB: Single Node App MongoDB
MongoDB: Replica Sets App MongoDB Primary MongoDB Secondary MongoDB Secondary
MongoDB: Sharding App config App App mongos mongos mongos MongoDB Primary MongoDB Primary MongoDB Primary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary Shard Shard Shard config config
Amazon Web Services
Amazon Web Services • Complete cloud infrastructure – Compute – Storage – Database – Analytics – Deployment • Multitude of configuration options • Pricing flexbility – On-demand, Spot, Reserved instances
EC2 Instance Types • General Purpose • Compute-optimized • GPU • Memory-optimized • Storage-optimized • Micro
EC2 Instance Types • General Purpose • Compute-optimized • GPU (compute resources not needed) • Memory-optimized • Storage-optimized • Micro (bursty, no sustained CPU)
EC2 Instance Types • General Purpose – M1, M3 • Compute-optimized – C1, CC2, C3 • Memory-optimized – M2, CR1 • Storage-optimized – HS1, HI1, I2
Instance Details • Differences in – CPU, Memory, Storage, Networking • Networking – EBS-optimized, Enhanced, Cluster • Availability – Not all are available in all regions
Zones, Regions, Security • Regions – Data center • Availability Zones – Rack in a data center • Security – Security Groups, VPC us-east1 uswest-1 uswest-2 1b 1a 2a 1c 1d 2b 1c 2c
Components and Sizing mongod config Core database process Sharding metadata High performance Smaller Memory, Storage, Network m1.small or m1.medium mongos Sharding query router Deploy on app server
Replica Sets: Security Groups App “application” MongoDB Primary MongoDB Secondary MongoDB Secondary “database”
Replica Sets: Availability Zones App MongoDB Primary MongoDB Secondary Zone 1 MongoDB Secondary Zone 2 Zone 3
Replica Sets: Regions App MongoDB Primary MongoDB Secondary Region 1 MongoDB Secondary Region 2
Replica Sets: Regions and Zones App MongoDB Primary MongoDB Secondary Region 1 MongoDB Secondary Region 2
Sharding: Regions App config App App mongos mongos mongos config config Region 1 MongoDB Primary MongoDB Primary MongoDB Primary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary Shard Shard Shard Region 2
Sharding: Regions App App mongos mongos mongos MongoDB Primary MongoDB Primary MongoDB Primary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary MongoDB Secondary Shard config App Shard Shard config config Region 1 Region 2
High Availability • Use Replica Sets – Deploy in odd numbers – Maintain majority MongoDB Primary • Withstand the loss of – Any single zone? – Any single region? – Deploy in 3 places MongoDB Secondar y • Scale – Replica Sets for HA – Sharding for scale – Combine for both MongoDB Secondar y 1 2 3
Deployment Considerations • How much availability do you need? • Can you withstand loss of zone, region? • Where is your app and where are your users? • What are the security requirements? – Note: security groups don’t span regions – SSL or VPC
Instance Configuration Best Practices • Amazon Linux • Install via yum for flexibility • Use PIOPS EBS • Update system settings • Launch EBS optimized
Instance Configuration Best Practices • Launch as EBS-optimized • Use separate PIOPS volumes for data, log, journal • Use EXT4 • Set read ahead • Update ulimits • Update TCP KeepAlive
Sensible Instance Defaults • Best practices are meant to be a sensible starting point • Amazon Linux optimized for EC2 • EBS provides persistent storage • EBS-optimized allocates additional NIC for storage • Provisioned IOPS provides consistent EBS performance
Sensible Instance Defaults • Individual volumes to reduce IO contention • Default read ahead is too high • Default ulimits are too low • Default keepalive too low
AWS Marketplace • The AWS Marketplace is an online store that helps users find, buy, and deploy software. • Launch pre-configured software and let AWS handle billing and payments
MongoDB on AWS Marketplace
MongoDB on AWS Marketplace
MongoDB Configurations • Follows MongoDB best practices – Amazon Linux, MongoDB installed via yum – EBS PIOPS volumes per mount (data, log, journal) – Configured: ulimits, read ahead, keep alive Data Config Log Journal Size IOPS Size IOPS Size IOPS 1000 IOPS 200 GB 1000 10 GB 100 25 GB 250 2000 IOPS 200 GB 2000 15 GB 150 25 GB 250 4000 IOPS 400 GB 4000 20 GB 200 25 GB 250
MongoDB Management Service
MongoDB Management Service • MongoDB Management Service (MMS) is a suite of services for managing MongoDB deployments. • Engineered by the team who develops MongoDB, MMS makes it easier to operate MongoDB at any scale. • MMS provides monitoring, backup and recovery, helping users optimize clusters and mitigate operational risk. • MMS users can visualize database performance and set custom alerts that notify when particular metrics are out of normal range. • MMS is also the only continuous backup solution for MongoDB, providing point-in-time recovery for replica sets and cluster-wide snapshots of sharded systems.
MMS Monitoring • MongoDB-specific metrics • Performance visualization • Metrics dashboards • Custom alerts and notifications
MMS Monitoring • Agent-based deployment monitoring • Opcounters, memory usage, index usage, lock %, connections, background flush, queues, page faults, and more • Notifications and alerts on any metric and condition • Agent pre-installed on AWS Marketplace instances
Coming Up Next • Part 2 in late March – Storage Configurations – Storage Tradeoffs – Disaster Recovery • Part 3 in late April – Integrating with AWS Services – CloudFormation – Elastic MapReduce
Resources • MongoDB on AWS best practices: – http://docs.mongodb.org/ecosystem/platforms/amazonec2/#deploy-mongodb-on-ec2 • MongoDB on AWS Marketplace: – https://aws.amazon.com/marketplace/sellerprofile/ref=dtl_pcp_sold_by?ie=UTF8&id=c9032c7b-70dd459f-834f-c1e23cf3d092 • MongoDB docs – http://docs.mongodb.org
#MongoDBWorld MongoDB World New York City, June 23-25 See what’s next in MongoDB including • MongoDB 2.6 • Sharding • Replication • Aggregation http://world.mongodb.com Save 25% with discount code 25SandeepParikh
MongoDB and Amazon Web Services: Deploying for High ... practices for those running MongoDB on ... across multiple availability zones in order to ...
... 1: Deploying for High Availability . ... MongoDB and Amazon Web Services are a great match for those deploying and scaling applications in the cloud ...
Amazon Web Services – MongoDB on AWS ... Designs for Deploying MongoDB on AWS 11 High-Performance Storage 12 High Availability and Scale 15 MongoDB: ...
Amazon Web Services – MongoDB on AWS May ... Designs for Deploying MongoDB on AWS 12 High-Performance Storage 12 High Availability and Scale 15 MongoDB: ...
Amazon Web Services – MongoDB on the AWS Cloud ... for deploying a MongoDB cluster on the Amazon Web ... high availability and durability. Amazon
MongoDB and Amazon Web Services: Deploying for High Availability 4:48 PM MongoDB, NoSQL, Pics, Tutorials. MongoDB and Amazon Web Services: Deploying for ...
MongoDB for AWS Marketplace is the high performance, document database that you love tuned and optimized for Amazon Web Services ... MongoDB with 4000 IOPS ...
MongoDB on AWS Webinar Series. ... MongoDB and Amazon Web Services are a great match for those deploying and scaling applications in the cloud.