Floating FB popout byF5debug

Installing and Configuring MongoDB on Windows Azure Virtual Machine - Part 1 – #Meet Azure Edition

 

In this tutorial we are going to see how to install MongoDB on a Windows Azure Virtual Machine environment later we will use this MongoDB in our application to store the data. MongoDB is one in a family of NoSQL databases where instead of storing data in relational format it stores the data in Non relational key value pairs as documents like dynamic schemas which makes the integration and retrieving of data quite easier for the application when it comes to performance. MongoDB is more powerful and highly scalable which provides more flexibility.    [more]

Steps:

To start with first create a new Windows Azure Virtual Machine (See the step by step process on how to create a virtual machine using this article Windows Azure Virtual Machines – Meet Azure Edition ). We will use the same setup and install the MongoDB on to the Windows Server 2008 R2 with SP1 as we have the image readily available in the Gallery of Windows Azure Virtual machines.

Taking into consideration that the steps are followed based on the above tutorial of creating a Windows Azure Virtual Machines and logging in with the Remote Desktop Procedure and you can see the screen as below.

image

Let us start installing the MongoDB, open Internet Explorer and go the MongoDB website which is www.mongodb.org/ and click on downloads to download the setup files as shown in the screen below.

image

Install the latest production release from the list of available downloads which is specific to our environment which is a 64bit windows operating system and save it on to the server desktop as shown in the screen below.

image

Now extract the downloaded zip file and place it an appropriate folder using which we need to run the scripts from the command prompt to install the database as shown in the screen below.

image

Now create 2 folder one for the MongoDB Data and other for the MongoDB logs in a folder which is accessible in any of the drives available. Here we will create with the C: Drive as shown in the screen below.

image

Open Command Prompt and run the below scripts which will create the database as shown in the screen below.

Script:

C:\Users\Administrator\Desktop\MongoDB\bin>mongod --dbpath C:\Data\ --logpath C:\Logs\mongolog.log

image

Executing this script will make all the logs files to be moved to the log folder and the data to the data folder when the MongoDB is up and running. Now to start the MongoDB open a Command Prompt windows again and enter the below script, it will open the MongoDB administrative Shell as shown in the screen below.

image

Note – Keep the first Command Prompt in running stage as it maps the data and the log path which basically the server needs it while connecting the database.

Now the database is up and running let us add some data to it. Run the scripts as shown in the screen below which adds the data to the database.

image

We can see the command writes the data to the database and we have provided the data as a Key Value pair. Now to retrieve the data which we inserted run the below command as shown in the screen below.

Script:

db.foo.find() 
 
image


So we are good with our database and the execution of the database. But this DB is available locally to the machine but to access it outside we need to have set of configuration which we will be seeing in our next article. See you all in the next tutorial until then happy programming!!!

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter