When I started to look for nosql, googling around and then I found
mongodb. Read few articles and seem quite interesting to play around.
This installation I did on window xp 32bit, so let start the fun parts.
1) Download the latest mongodb in
http://www.mongodb.org/downloads.
2) Extract the folder to your preference path. For my case, I extracted to D:\mongodb
3) Inside mongodb folder, create data/db and log folder. You should get something like this
4) Create a config file in bin folder. Example: D:\mongodb\bin\mongodb.config
5) Create a log.txt in d:\mongodb\log\log.txt
6) Inside mongodb.config, paste below code and save the file.
dbpath = d:\mongodb\data\db
bind_ip = 127.0.0.1
port = 27017
logpath = d:\mongodb\log\log.txt
#logappend = true
directoryperdb = true
#journal = true
rest= true
For what the setting for, you can refer
http://www.mongodb.org/display/DOCS/File+Based+Configuration. The hash # mean comment out and will not set that setting.
7) Next, set environment variable. PATH variable add in D:\mongodb\bin; Refer below to set it
Select the path, click on edit button, append the path url to the end and click Ok
D:\mongodb\bin;
Now we ready to install into windows service.
8) Open cmd from run box
9) Navigate your path to D:\mongodb\bin
10) Execute the install code as below
mongod --config D:\mongodb\bin\mongodb.config –-install
As you can see, the installation will log into your D:\mongodb\log\log.txt.
You will see successful message inside the log as below
Last step to check and start the mongod service
11) Open services.msc in run box and you will get mongodb inside the list. Right click and start the service or you can run from command prompt
Start from command prompt.
Phew, done install mongodb as service. Now we can try to connect to mongodb by execute mongo as below
With this, we good to play around with mongodb.
Notes:
To stop mongodb using cmd
net stop mongodb
To remove/uninstall mongodb service
mongod --remove