1.866.iQmetrix MongoDB on Azure Agenda Me / iQmetrix Architecture NoSQL databases MongoDB 10gen Running MongoDB in Azure History, Issues MMS [if we have time]
1.866.iQmetrix John Woakes I work for iQmetrix as a Lead Developer Started as Cobol programmer Oracle Developer/DBA SQL Server and.NET This is my first presentation – be gentle.
1.866.iQmetrix iQmetrix Started in Regina 1999-ish Vancouver, Winnipeg and Charlotte Creating Software for the mobile retail industry RQ4 – Retail Management System XQ – Interactive Retail
1.866.iQmetrix Azure Component 4 Web Roles – Http API and Console 3 Worker Roles – MongoDB replica sets 1 Worker Role – background functions 1 Azure Queue Several Service Bus Queues Blob storage for images/video and backups Table storage for logs
1.866.iQmetrix Clients About 1000 devices 4 Client customer facing applications Adplay media player Browse app for detailed product information Stream app iPad Browse RQ4 updates prices and quantities
1.866.iQmetrix NoSQL Databases Relatively new Often open source Designed to work well in the cloud Scale out not up Good for big data Not a replacement for Relational Databases
1.866.iQmetrix NoSQL Databases MongoDB - CouchDB RavenDB BigTable Cassandra
1.866.iQmetrix Users of MongoDB CraigsList FourSquare EA GitHub Disney MTV Loggly
1.866.iQmetrix Why MongoDB? What uses the most CPU/IO in Relational Databases? Transactions Joins MongoDB is document based (no joins, no transactions) Documents can contain sub-documents Can index sub-documents and arrays
1.866.iQmetrix Change the way you think Important points Schema design is very important There is no schema in MongoDB Resist Normalization Uses a memory mapped model Goes faster with lots of servers and lots of RAM
1.866.iQmetrix 10gen CEO developed MongoDB It is open source and is on GitHub – C++ 10gen provideshttp:// 1.Support 2.Training inc. online videos 3.Conferences worldwide 4.Drivers in lots of languages [including.NET] 5.Code and documentation inc. Mongo in Azure
1.866.iQmetrix Stores data as bson Console uses JavaScript and json 3 rd party GUI tools Database runs as an exe or Windows service Memory mapped so really needs 64bit OS User group on Google Groups [busy] C# driver has LINQ support and full functionality Sharding for fast access and huge storage Main Points
1.866.iQmetrix Good for terabytes of data and billions of records Replica Sets for high availability [auto failover] Sharding spreads queries over multiple servers Geospatial data and functions GridFS for storing large binary data Main Points cont.
1.866.iQmetrix Microsoft and 10gen worked together to make MongoDB work well in Azure Microsoft support and promote MongoDB on Azure Microsoft Open Technologies, Inc. 10gen have code and documentation on their site to run MongoDB on Azure Azure
1.866.iQmetrix Run mongo on an Azure Virtual Machine You have to look after the OS and Firewall You could use Linux or Windows It is more hands on If you have a VM already then you can use that. Use an Azure Data Drive for persistence Azure Options
1.866.iQmetrix Use an Azure Worker Role to host MongoDB PaaS so MS looks after OS Runs on internal IP addresses so no Firewall concerns This is what we use and will now describe Azure Options
1.866.iQmetrix Original article that got us going azure-clouddrive/ 10gen’s documentation Azure+Worker+Roles 10gen’s source code Azure Code
1.866.iQmetrix Use Worker Roles to run MongoDB Need Azure SDK 1.7 [June 2012] Use an Azure Cloud Drive to persist the database Download the MongoDB binaries [get the 64bit 2008+] In the worker role ServiceConfiguration file add <ServiceConfiguration osFamily="2" osVersion="*" Azure Code
1.866.iQmetrix Include the MongoDB binaries you need in the Worker Role project [set to content and Copy Always] mongod.exe – database engine mongo.exe – console mongodump.exe – used to backup data mongorestore.exe – used to restore data mongostat.exe – useful for real time stats Azure Code
1.866.iQmetrix Mount a Cloud Drive with Blob storage backing Run the mongod.exe in a Process Set up command line arguments Hook up listeners on the std and error outputs Start the process Once the database is running execute the initialize replica set command Azure Code
1.866.iQmetrix Download the C# driver from NuGet Other role instances in the hosted service can talk to the database with this driver. Use role instance host names when setting up the connection string. Host names are zero based and will follow the pattern NAMEx not 1 based and NAME0x as the doc tell you. Azure Code
1.866.iQmetrix Went to PDC about 2 years ago Got Mongo running on a single instance Went into production about 1 year ago Added replica sets about 6 months ago 4 week iterations – just moved 2 week History
1.866.iQmetrix Outages when on one instance Alpha MongoDB code using replica sets Azure outage on Service Bus An unknown outage just this month Backup data Make your code resilient as possible Log everything Monitor logs and have alerts Issues
1.866.iQmetrix Very cool and useful free service from 10gen Install a Python Agent on a instance that has access to the MongoDB servers. The agent sends stats data to a 10gen server You then login to the MMS dashboard website and monitor your databases in real time. ring+Service MMS