下载地址: http://www.mongodb.org/downloads
2、解压并且重命名为mongodb,copy到D:/websoft/下,注:这个是我的命名及其目录结构,可以根据你自己的习惯执行 3、在mongodb文件件下,新建两个文件data和logs 4、配置mongodb服务器: 4.1 cmd进入到:D:/websoft/mongodb/bin下(操作:1.d: 2.cd :/websoft/mongodb/bin); 4.2 命令:mongod --dbpath d:/websoft/mongodb/data 打印如下后:
。。。。。。。 Thu Dec 12 11:27:14.295 [FileAllocator] done allocating datafile d:/websoft/mong odb/data\local.0, size: 64MB, took 0.261 secs Thu Dec 12 11:27:14.299 [initandlisten] command local.$cmd command: { create: "s tartup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 reslen:37 386ms Thu Dec 12 11:27:14.346 [initandlisten] waiting for connections on port 27017 Thu Dec 12 11:27:14.347 [websvr] admin web console waiting for connections on port 28017
4.3 打开浏览器:http://localhost:27017/
显示结果为:
You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
到此,monggodb启动成功。
5、把mongodb加入到windows服务启动项中:
5.1cmd 进入到:D:/websoft/mongodb/bin下(操作:1.d: 2.cd D:/websoft/mongodb/bin);
5.2 命令:
mongod.exe --logpath d:/websoft/mongodb/logs --logappend --dbpath d:/websoft/mongodb/data --directoryperdb --serviceName MongoDB -install
5.3 打开window服务,可以看到MongoDB服务。
以后可以在cmd中直接这样启动:
net start MongoDB和net stop MongoDB来启动和停止MongoDB,或者可以在本地服务中操作