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.
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.
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.
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.
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.
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
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.
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.
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()
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!!!
No Comments
I generally stick to a select few websites when to comes to looking up gaming computers laptops etc however when I stumbled across yours I realised this isn't just another copy and paste site. Keep it up I'll be back to check out whats new