2014年5月13日 星期二

Mongo DB install issue (update)

Mongo DB install issue

1.  Download Mongo DB
This demo is based on version 2.6.

2.  Create DB’s data directory
$\MongoDB 2.6 Standard\bin> md C:\MongoDB\data\db

3.  Start Mongo with the specific DB:data directory (Default is C:\data\db)
$\MongoDB 2.6 Standard\bin> mongod.exe --dbpath C:\MongoDB\data\db

PS. C:\MongoDB\data\db is what we create in step 2.



4.  Connect
$\MongoDB 2.6 Standard\bin> mongo

Client


Host



5.  OK, we will make the mongo as a windows service in the following setup.
6.  Create config file

First, we create a Mongo log folder :
$\MongoDB 2.6 Standard\bin> md C:\MongoDB\log

Create a config file and set the log filepath property …
C:\MongoDB>echo logpath=C:\MongoDB\log\mongo.log > C:\MongoDB\mongod.cfg

Set the DB:data directory to the config …
C:\MongoDB>echo dbpath=C:\MongoDB\data\db >> C:\MongoDB\mongod.cfg

then add the following settings into the “mongod.cfg”.
logappend=true




Start Mongo DB as a windows service

Install the Mongo service
$\MongoDB 2.6 Standard\bin> mongod.exe --config C:\MongoDB\mongod.cfg --install

Start the service
$\MongoDB 2.6 Standard\bin> net start MongoDB




5.  Stop the Mongo service
$\MongoDB 2.6 Standard\bin> net stop MongoDB

6.  Remove the service
$\MongoDB 2.6 Standard\bin> mongod.exe –remove


沒有留言:

張貼留言