Monday, 5 February 2018

Install Mongodb in 5 simple steps

Step 1 : Know your computer architecture
open command prompt and type the below command:
 C:\>wmic os get osarchitecture
This will give architecture of your PC.


Step 2 : Download mongo db
Download as per your PC architecture from below link:
https://www.mongodb.org/downloads - Zip file

Step 3 : Extract to c:\ drive Or unzip and save in c drive
Name of the extracted folder will be mongodb-win32-i386-[version]
Or you may choose your own folder name.

Step 4 : Create mongodb data folder.
MongoDB requires a data folder to store its files.
The default location for the MongoDB data directory is c:\data\db.
So you need to create this folder using the Command Prompt.
Execute the following command sequence.
This is the path where all your mongo data will be saved.
C:\>\md data\db or Create manually.

Step 5: Final Step - Run your mongodb
Then issue the below command to set the data path.

C:\mongodb-win32-x86_64-enterprise-windows-64-3.6.2\bin>mongod.exe --dbpath "c:\data\db"

Now to run the MongoDB, you need to open another command prompt and issue the below command to set the data path
C:\mongodb-win32-x86_64-enterprise-windows-64-3.6.2\bin>mongo.exe


Next time when you run MongoDB, you need to issue only commands.

C:\mongodb-win32-x86_64-enterprise-windows-64-3.6.2\bin>mongod.exe --dbpath "c:\data\db" 
C:\mongodb-win32-x86_64-enterprise-windows-64-3.6.2\bin>mongo.exe -->Run this in new cmd

Note:You can place your mongo db in any of the drive not necessarily in c drive.
Also you can make your data folder any where as well
But c drive is recommended to avoid any confusion.



No comments:

Post a Comment

Handaling XLS File In Java

This code will help you to handle xls file in java using apache poi. package test; import java.io.File; import java.io.FileInputStream...