Windows环境下MongoDB的安装
下载MongoDB到某个目录下,例如,F:\openSource\nosql\mongodb_2.4.6。浏览bin
目录下的文件,如下所示:
创建一个mongoDB的配置文件,命名mongo.config,写入如下设置:
##store data here
dbpath=F:\mongodb_data\db
##all output go here
logpath=F:\mongodb_data\log\mongo.log
##log read and write operations
diaglog=3
启动MongoDB Server, 命令行模式下,运行如下命名:
mongod.exe –config F:\openSource\nosql\mongodb_2.4.6\mongo.config
使用客户端连接mongoDB Server, 运行如下命名:
mongo.exe
MongoDB shell version: 2.4.6
connecting to: test
>//mongodb shell
如果想将MongoDB作为windows service来启动,运行如下命令即可:
mongod --config D:\mongodb\mongo.config --install
安装service成功后,使用如下命名可以控制MongoDB Service。
启动服务
net start MongoDB
停止服务
net stop MongoDB
删除服务
mongod --remove