Win7 下面安装MongoDB
2015-08-14 17:01
579 查看
1. MongoDB download
From website: https://www.mongodb.org/downloads
Download version: mongodb-win32-x86_64-2008plus-ssl-3.0.1.zip
2. Decompress MongoDB zip file
Decompress Path: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1
3. Before install MongoDB
Create data directory: mongod --dbpath C:\MongoDB\mongoadmin\data;
Create log file directory: C:\MongoDB\mongoadmin\log , C:\MongoDB\mongoadmin\log\log.txt;
4. Launch MongoDB
Enter directory: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, and execute Mongod.exe command like below:
mongod --logpath=C:\MongoDB\mongoadmin\log\log.txt --dbpath=C:\MongoDB\mongoadmin\data;
Launch MongoDB with configure file:
mongod --config /data/config/mongod.conf
/*Mongo support YAML format in configuraion*/
5. Install as a service
Enter directory with Administrator: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, and exec below Mongod command:
mongod --install --logpath=C:\MongoDB\mongoadmin\log\log.txt --dbpath=C:\MongoDB\mongoadmin\data
Query to see if install successfully:
sc qc mongodb
6. Enter shell enviornment
Enter directory: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, type "mongo"
Type "mongod --help" can browse more detail help info.
7. Start and Stop MongoDB
Enter cmd with administrative privileges:
Start mongoDB service: net start mongodb
Test to see if mongoDB can be connected: mongo
Stop mongoDB service: net stop mongodb
/* Check file data\mongod.lock to see if is a clean shutdown,
* net start makes file size larger than 1 kB, net stop clean this file, make size as 0
*/
remove it from services if needed: mongod --remove
Shutdown from shell:
1) Enter cmd with administrative privileges:
2) Type "mongo" to enter shell environment:
3) Type "use admin"
4) Type "db.shutdownServer()"
5) Check mongod.lock to see if a clean shutdowm
Check MongoDB Status:
1) Type "db.serverStatus()"
8. Dirty Shutdown Recovery
Enter cmd with administrator privileges: mongod --port 4000 --dbpath C:\MongoDB\mongoadmin\data;
/* run mongodb with another non-standard port as 4000, will recover data first */
*******************************************************************************************************************************************
********* 常见问题
*******************************************************************************************************************************************
1. 由于目标计算机积极拒绝,无法连接
先打开mongoDB service, 才能进行连接 : 1)net start mongodb
2) mongo
2. In File::open(), CreateFileW for 'U:\mongorc.js'系统找不到指定路径
启动shell,会自动加载.mongorc.js,启动时加上mongo --norc就可以跳过此文件加载
From website: https://www.mongodb.org/downloads
Download version: mongodb-win32-x86_64-2008plus-ssl-3.0.1.zip
2. Decompress MongoDB zip file
Decompress Path: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1
3. Before install MongoDB
Create data directory: mongod --dbpath C:\MongoDB\mongoadmin\data;
Create log file directory: C:\MongoDB\mongoadmin\log , C:\MongoDB\mongoadmin\log\log.txt;
4. Launch MongoDB
Enter directory: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, and execute Mongod.exe command like below:
mongod --logpath=C:\MongoDB\mongoadmin\log\log.txt --dbpath=C:\MongoDB\mongoadmin\data;
Launch MongoDB with configure file:
mongod --config /data/config/mongod.conf
/*Mongo support YAML format in configuraion*/
5. Install as a service
Enter directory with Administrator: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, and exec below Mongod command:
mongod --install --logpath=C:\MongoDB\mongoadmin\log\log.txt --dbpath=C:\MongoDB\mongoadmin\data
Query to see if install successfully:
sc qc mongodb
6. Enter shell enviornment
Enter directory: C:\mongodb-win32-x86_64-2008plus-ssl-3.0.1\bin, type "mongo"
Type "mongod --help" can browse more detail help info.
7. Start and Stop MongoDB
Enter cmd with administrative privileges:
Start mongoDB service: net start mongodb
Test to see if mongoDB can be connected: mongo
Stop mongoDB service: net stop mongodb
/* Check file data\mongod.lock to see if is a clean shutdown,
* net start makes file size larger than 1 kB, net stop clean this file, make size as 0
*/
remove it from services if needed: mongod --remove
Shutdown from shell:
1) Enter cmd with administrative privileges:
2) Type "mongo" to enter shell environment:
3) Type "use admin"
4) Type "db.shutdownServer()"
5) Check mongod.lock to see if a clean shutdowm
Check MongoDB Status:
1) Type "db.serverStatus()"
8. Dirty Shutdown Recovery
Enter cmd with administrator privileges: mongod --port 4000 --dbpath C:\MongoDB\mongoadmin\data;
/* run mongodb with another non-standard port as 4000, will recover data first */
*******************************************************************************************************************************************
********* 常见问题
*******************************************************************************************************************************************
1. 由于目标计算机积极拒绝,无法连接
先打开mongoDB service, 才能进行连接 : 1)net start mongodb
2) mongo
2. In File::open(), CreateFileW for 'U:\mongorc.js'系统找不到指定路径
启动shell,会自动加载.mongorc.js,启动时加上mongo --norc就可以跳过此文件加载
相关文章推荐
- MongoDB之索引
- MongoDB 3.05集群分片配置
- UbuntuServer12.04安装MongoDB,开机自启,服务,权限
- MongoDB常用方法
- mongodb怎样导出数据为csv或者txt格式
- MongoDB 索引
- Mongodb建函数
- Mongodb数据导出工具mongoexport和导入工具mongoimport介绍
- VB.NET读写MongoDB
- mongodb存取图片文件功能
- MongoDB 权限
- MongoDB 中遇到的一些错误
- 使用mongo-java-driver3.0.2.jar和mongodb3.0在java代码中的用户验证4
- Elasticsearch、MongoDB和Hadoop比较
- Spring Data MongoDB 五:进阶文档查询(分页、Morphia)(二)
- NoSql---MongoDB基本操作
- 关于pymongo两种连接方法MongoClient和Connection连接mongodb的写入效率分析
- nodejs+express+mongodb
- mongodb3.x远程登录和认证问题
- Centos7安装配置Mongodb3