MongoDB and Windows Azure

25
MongoDB and Windows Azure Doug Mahugh Senior Technical Evangelist Microsoft Open Technologies, Inc. Sridhar Nanjundeswaran Software Engineer 10gen

description

Overview of Windows Azure's current support for MongoDB deployments on IaaS virtual machines or PaaS worker roles. Presented at MongoDB Seattle, 9/14/2012.

Transcript of MongoDB and Windows Azure

Page 1: MongoDB and Windows Azure

MongoDB and Windows Azure

Doug MahughSenior Technical EvangelistMicrosoft Open Technologies, Inc.

Sridhar NanjundeswaranSoftware Engineer10gen

Page 2: MongoDB and Windows Azure

Agenda

• Overview of Windows Azure

• MongoDB on Windows Azure

• Deploying MongoDB as a Cloud Service

• Deploying to Virtual Machines

• Best Practices, Tips & Tricks

Page 3: MongoDB and Windows Azure

Windows Azure

Windows Azure provides a comprehensive set of services that you can selectively compose to build your cloud apps and services

Global Data Center Footprint99.95% Monthly SLA / pay only for what you use

Flexible & Open Compute OptionsVirtual Machines, Web Sites, & Cloud Services

Managed Building Block ServicesBlob storage, SQL Database, Cache, Service Bus, & more

Page 4: MongoDB and Windows Azure

Applicationbuilding blocks

StorageBig data

Caching

CDN

Database

Identity

Media

Messaging

Networking

Traffic

Page 5: MongoDB and Windows Azure

Open Source on Windows AzureMicrosoft works with leading OSS communities to assure that popular applications, frameworks and tools work great with Windows Azure

Learn more: http://www.windowsazure.com/en-us/community/open-source-software/

Page 6: MongoDB and Windows Azure

Microsoft Open Technologies, Inc.• Wholly owned subsidiary of

Microsoft

• Responsible for advancingthe company’s investmentin openness:• interoperability• open standards• open source

• Collaborating with the MongoDB community since 2011 to improve the MongoDB experience on Windows Azure

Page 7: MongoDB and Windows Azure

• Open-source SDKs forpopular programminglanguages, to get youup and running quickly

• Choice of popular IDEssuch as Visual Studioand Eclipse

• Consistent REST protocols and APIs across Windows Azure serviceshttp://www.windowsazure.com/en-us/develop/overview/

Windows Azure Developer Center

MongoDB drivers:

.NET driver

Node.js driver

Java driver

PHP driver

Python driver

Driver download page

Page 8: MongoDB and Windows Azure

A container of related service roles

Web Roles Worker Roles

Windows Azure Cloud Service

Page 9: MongoDB and Windows Azure

Windows AzureVirtual Machines

Windows Server 2008 R2

Windows Server 2012

OpenSUSE 12.1

CentOS 6.2

Ubuntu 12.04

SUSE Linux Enterprise Server SP2

Page 10: MongoDB and Windows Azure

Virtual Machine Sizes

Each Persistent Data Disk Can be up to 1 TB

VM SizeCPU Cores

MemoryBandwidth (Mbps)

# Data Disks

Extra Small

Shared 768 MB 5 1

Small 1 1.75 GB 100 2

Medium 2 3.5 GB 200 4

Large 4 7 GB 400 8

Extra Large

8 14 GB 800 16

Page 11: MongoDB and Windows Azure

Windows Azure Management Portalhttp://manage.windowsazure.com

Old portal is available athttps://windows.azure.com

Page 12: MongoDB and Windows Azure

Getting Started

http://www.windowsazure.com/en-us/pricing/free-trial/

Page 13: MongoDB and Windows Azure

MongoDB + Windows Azure

• MongoDB designed to run in the cloud• Windows Azure supports multiple architectures for

MongoDB deployment• The combination of MongoDB and Windows Azure

provides many benefits:• High scalability and elasticity• On-demand capacity• Pay for only what you use• Faster time-to-market

Page 14: MongoDB and Windows Azure

Replica set hostedon Windows Azure

worker roles orvirtual machines

Replica Set

Primary

Secondary

Secondary

DriverYour Application

Replica Sets: high availability

Page 15: MongoDB and Windows Azure

Shards and mongos (router) hosted on Windows Azure worker roles or virtual machines

Key range A-B

Primary

Secondary

Secondary

Sharding: high scalability and throughput

Key range B-C

Primary

Secondary

Secondary

Key range C-D

Primary

Secondary

Secondary

Key range D-E

Primary

Secondary

Secondary

Mongos (router)

Your Application

Page 16: MongoDB and Windows Azure

MongoDB + Windows Azure benefits

Flexible

• PaaS or IaaS deployment• Java, PHP, Node.JS, .NET, or Python• Many OS options including Windows Server, CentOS,

Ubuntu, SUSE

Scalable

• MongoDB’s built-in support for horizontal scaling and sharding

• Windows Azure’s built-in support for responsive auto-scaling

MongoDB on Windows Azure provides all the benefits customers have come to expect from cloud computing: elasticity, on-demand capacity, faster time to market, and pay-for-what-you-use pricing

Page 17: MongoDB and Windows Azure

Deploying MongoDB as a Cloud Service

• Windows Azure cloud servicesrun on a fully automated, highlyscalable cloud platform

• Ongoing management of the OS and infrastructure is handled by Windows Azure

• Infinitely scalable, on demand• App and MongoDB in same cloud service provides

security • PaaS approach is the easiest way to deploy MongoDB

on Windows Azure• For quick and simple deployment, use the MongoDB

Azure wrapper:http://www.mongodb.org/display/DOCS/MongoDB+on+Azure+Worker+Roles

Page 18: MongoDB and Windows Azure

Deploying to Virtual Machines

• Compared to worker role, VM-basedreplica sets offer more control, aswell as more responsibility

• MongoDB Installer for Windows Azure is a great learning tool. Not typically used for production deployment.• Puts MongoDB on OS disk instead of attached disk• Limited to 30gb, not performant for writes, Windows-only• http://www.mongodb.org/display/DOCS/MongoDB+on+Azure+VM+-+Windows+I

nstaller

• .\deploy-mongo.ps1 <node-count> <dns-prefix> <image-name> <password> <location> <pub-settings-file-path> [replica-set-name]

• For Linux VM deployment, see tutorial - http://www.windowsazure.com/en-us/manage/linux/common-tasks/mongodb-on-a-linux-vm/

Page 19: MongoDB and Windows Azure

Scripting Capabilities• Windows Azure PowerShell Cmdlets• Cross Platform Scripting Built on node.js• Service Management APICapabilities:• Provisioning, Removal• Reboot, Start• Import and Export VM settings• Support for Windows and Linux VMs• Fully Customize VM with Data Disks and Endpoint Configuration• Automate Virtual Network Settings

Page 20: MongoDB and Windows Azure

azure topic verb options

Command Line Syntax Overviewprompt>

accountaccount locationaccount affinity-groupvmvm diskvm endpointvm imageserviceservice certsiteconfig

downloadimportlistshowdeletestartrestartshutdowncapturecreateattachdetachbrowseset

usernamepassworddns-prefixvm-namelb-porttarget-image-namesource-pathdisk-image-namesize-in-gbthumbprintvalue-v-vv

Page 21: MongoDB and Windows Azure

Example: Provisioning a Replica Setazure vm create mongoc9 "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e azure vm create mongoc9 "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e 23 -c azure vm create mongoc9 "OpenLogic__OpenLogic-CentOS-62-20120531-en-us-30GB.vhd" username password -l "West US" -e 24 -c

azure vm endpoint create mongoc9 27017 27017azure vm endpoint create mongoc9-2 27018 27018azure vm endpoint create mongoc9-3 27019 27019

To set up MongoDB, SSH into each instance and:

get mongodb binaries and installcreate db dirstart mongod, initialize replica set

Page 22: MongoDB and Windows Azure

DEMO-PaaS

Monitoring service: http://beefb1a5abb743f086e57c5f7bf5d3cf.cloudapp.net/

App deployed with the MongoDB Replica Set wrapper for Windows Azure http://beefb1a5abb743f086e57c5f7bf5d3cf.cloudapp.net:8080/

Page 23: MongoDB and Windows Azure

DEMO-IaaS

Local MongoDBinstance Primary

mongo-demo.php

mongo-demo.php?host=localhost

Replica set onLinux VMs Primary Secondary Secondary

mongo-demo.php?host=linux

Replica set onWindows VMs Primary Secondary Secondary

mongo-demo.php?host=windows

Page 24: MongoDB and Windows Azure

Resources• MongoDB on Azure:

http://www.mongodb.org/display/DOCS/MongoDB+on+Azure+-+Overview• MongoDB Experts video series:

http://blogs.msdn.com/b/interoperability/archive/2012/06/01/mongodb-experts-video-series.aspx

• Windows Azure development:www.WindowsAzure.com

• Windows Azure Training Kit:http://windowsazure-trainingkit.github.com/

• OSS-on-Azure tutorials:http://ossonazure.interoperabilitybridges.com/tutorials

• Install MongoDB on a Centos virtual machine in Windows Azure:http://www.windowsazure.com/en-us/manage/linux/common-tasks/mongodb-on-a-linux-vm/

• Node.js Web Application with Storage on MongoDB (Virtual Machine):http://waweb.windowsazure.com/en-us/develop/nodejs/tutorials/website-with-mongodb-(mac)/

Page 25: MongoDB and Windows Azure

Q&A