mongoDB安装并随windows开机自启

MongoDB安装并随windows开机自启

MongoDB安装并随windows开机自启
MongoDB的官方下载站是http://www.mongodb.org/downloads,可以去上面下载最新的程序下来。在下载页面可以看到,对操作系统支持很全面,OS X、Linux、Windows、Solaris都支持,而且都有各自的32位和64位版本。目前的稳定版本是1.8.1版本。
1、Windows版本安装



(1)、下载MongoDB

 url地址: http://downloads.mongodb.org/win32/mongodb-win32-i386-1.8.1.zip

(2)、设置MongoDB目录

   解压到D盘下面的MongDB文件夹,路径为d:\MongDB
3)设置数据文件路径

在D:\MongoDB里面新建logs和data文件夹

在D:\MongoDB\logs里面新建mongodb.log文件



2,配置Mongo服务端:

打开cmd窗口:输入下面命令:

> d:
> cd D:\MongoDB\bin
> mongod --dbpath c:\MongoDB\data --logpath=c:\MongoDB\logs\mongodb.log --install










然后到服务中启mongodB

如果是win7的话。那启动cmd要用管理员身份来启动



安装:

mongod --dbpath "C:\mongodb\db" --logpath

"C:\mongodb\log.txt" --install --serviceName "MongoDB"

卸载:

mongod.exe --remove --serviceName "MongoDB"
3,客户端连接验证

新打开一个CMD输入:d:\mongodb\bin\mongo,如果出现下面提示,那么您就可以开始MongoDB之旅了:
D:\mongodb\bin>d:\mongodb\bin\mongo
MongoDB shell version: 1.8.1
connecting to: test
>



4,查看日志

D:\MongoDB\logs下面的mongodb.log










5.补充





   C:\MongoDB\bin>mongod --help

Windows Service Control Manager options:
  --install                install mongodb service
  --remove              remove mongodb service
  --reinstall             reinstall mongodb service (equivilant of mongod
                             --remove followed by mongod --install)
  --serviceName arg           windows service name
  --serviceDisplayName arg windows service display name
  --serviceDescription arg    windows service description
  --serviceUser arg              user name service executes as
  --servicePassword arg       password used to authenticate serviceUser

猜你喜欢

转载自xiaoming9920.iteye.com/blog/2187066