Mongo DB
install issue
2. Create DB’s data directory
$\MongoDB 2.6 Standard\bin> md C:\MongoDB\data\db
$\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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDP22XUKYprnoGgppeXjKJOeGD-QtZ3mCY_qVTD2Gr-HycCgCuSJVhOZGP8fXNIV7Dee065sbEqSboOL1yYNVlwYne5we5DeDm3NaQFhBEYrKdT4hOOvzTQt_qc0ivBmZm7u8tBZFSVEw/s1600/u001.jpg)
$\MongoDB 2.6 Standard\bin> mongod.exe --dbpath C:\MongoDB\data\db
PS. C:\MongoDB\data\db is what we create in step 2.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDP22XUKYprnoGgppeXjKJOeGD-QtZ3mCY_qVTD2Gr-HycCgCuSJVhOZGP8fXNIV7Dee065sbEqSboOL1yYNVlwYne5we5DeDm3NaQFhBEYrKdT4hOOvzTQt_qc0ivBmZm7u8tBZFSVEw/s1600/u001.jpg)
4. Connect
$\MongoDB 2.6 Standard\bin> mongo
$\MongoDB 2.6 Standard\bin> mongo
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
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”.
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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgng8KZWJqB_m1V6B3E3jqGymcE17B-Zbc9KeyasBwwu-Y32HpLcVPOV7spsSxHPCh__wOngs_BfkjicNg6-LO-fd-ruuV2a6WpZH96ugYQipBvF0mTf3eiNGb7l44xk19P_LfD1cdp81A/s1600/002.jpg)
5. Stop the Mongo service
$\MongoDB 2.6 Standard\bin> net stop MongoDB
$\MongoDB 2.6 Standard\bin> net stop MongoDB
6. Remove the service
$\MongoDB 2.6 Standard\bin> mongod.exe –remove
$\MongoDB 2.6 Standard\bin> mongod.exe –remove
7. Reference :
[.NET] 在 Windows 上安裝執行 MongoDB
[.NET] 在 Windows 上安裝執行 MongoDB
沒有留言:
張貼留言