MongoDB and Windows Azure

Post on 02-Dec-2014

3.561 views 1 download

Tags:

description

 

Transcript of MongoDB and Windows Azure

MongoDB and Windows Azure

Doug MahughSenior Technical EvangelistMicrosoft Open Technologies, Inc.

Sridhar NanjundeswaranSoftware Engineer10gen

Agenda

• Overview of Windows Azure

• MongoDB on Windows Azure

• Deploying MongoDB as a Cloud

Service

• Deploying to Virtual Machines

• Best Practices, Tips & Tricks

Windows Azure

Windows Azure provides a comprehensive set of services that you can selectively compose to build your cloud apps and servicesGlobal 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

Applicationbuilding blocks

StorageBig data

Caching

CDN

Database

Identity

Media

Messaging

Networking

Traffic

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/

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

• 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 services

http://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

A container of related service roles

Web Roles Worker Roles

Windows Azure Cloud Service

Windows AzureVirtual Machines

Windows Server 2008 R2

Windows Server 2012

OpenSUSE 12.1

CentOS 6.2

Ubuntu 12.04

SUSE Linux Enterprise Server SP2

Virtual Machine Sizes

Each Persistent Data Disk Can be up to 1 TB

VM Size CPU Cores

Memory

Bandwidth (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

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

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

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

Replica set hosted

on Windows Azure

worker roles orvirtual machines

Replica Set

Primary

Secondary

Secondary

DriverYour Application

Replica Sets: high availability

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

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

Deploying MongoDB as a Cloud Service• Windows Azure cloud services

run 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

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+Azur

e+VM+-+Windows+Installer

• .\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/

Scripting Capabilities• Windows Azure PowerShell Cmdlets• Cross Platform Scripting Built on node.js• Service Management API

Capabilities:• 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

azure topic verb options

Command Line Syntax Overviewprompt>

accountaccount locationaccount affinity-groupvmvm diskvm endpointvm imageserviceservice certsiteconfig

downloadimportlistshowdeletestartrestartshutdowncapturecreatecreate-fromattachattach-newdetachbrowseset

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

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

DEMO-PaaS

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

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

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

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)/

Q&A