简体   繁体   English

在Windows Server 2012上安装MongoDB

[英]install MongoDB on windows server 2012

I am trying to install MongoDB on Windows Azure VM which is running Windows 2012 Server 我正在尝试在运行Windows 2012 Server的Windows Azure VM上安装MongoDB

  1. I have mongodb in C:\\Program Files\\MongoDB\\bin 我在C:\\ Program Files \\ MongoDB \\ bin中有mongodb
  2. I have config file at D:\\mongodb\\mongod.cfg 我在D:\\ mongodb \\ mongod.cfg中有配置文件

And my config looks like this 我的配置看起来像这样

logpath=d:\mongodb\log\mongod.log
dbpath=d:\mongodb\data\db
port=27018 

now I want to run mongo db from config file so i go to command prompt and run below command c:\\Program Files\\MongoDB\\bin>mongod --config "D:\\mongodb\\mongod.cfg" this stays silent on command prompt no further response. 现在我想从配置文件运行mongo db,所以我转到命令提示符并在命令c:\\Program Files\\MongoDB\\bin>mongod --config "D:\\mongodb\\mongod.cfg"下运行没有进一步的回应。

Then I tried c:\\Program Files\\MongoDB\\bin>mongod --config "D:\\mongodb\\mongod.cfg" --install that give me bellow message 然后我尝试了c:\\Program Files\\MongoDB\\bin>mongod --config "D:\\mongodb\\mongod.cfg" --install给我以下消息

2014-05-02xxxxxx log file "d:mongodb\\log\\mongod.log" exists; 2014-05-02xxxxxx日志文件“ d:mongodb \\ log \\ mongod.log”存在; moved to "d:mongodb\\log\\mongod.log.2014-05-02xxxxx" 移至“ d:mongodb \\ log \\ mongod.log.2014-05-02xxxxx”

I guess this is just creating a log file for me. 我想这只是为我创建一个日志文件。

Now if I run mongod.exe it give me error saying dbpath (\\data\\db\\) does not exist . 现在,如果我运行mongod.exe它会给我错误,说dbpath(\\ data \\ db \\)不存在 But in my config file i gave the path as dbpath=d:\\mongodb\\data\\db 但是在我的配置文件中,我给出的路径为dbpath=d:\\mongodb\\data\\db

Changed my config file to YAML 将我的配置文件更改为YAML

systemLog:
   destination: file
   path: "e:\\mongodb\\log\\mongod.log"
   quiet: true
   logAppend: true
net:
   bindIp: 127.0.0.1
   port: 27018
storage:
   journal:
      enabled: true
   dbPath: "e:\\mongodb\\data\\db"

now I run mongod --config "C:\\MongoDB 2.6 Standard\\mongod.cfg" no response. 现在我运行mongod --config“ C:\\ MongoDB 2.6 Standard \\ mongod.cfg”没有响应。

Your config file has wrong syntax (it uses YAML syntax ). 您的配置文件语法错误(它使用YAML语法 )。 Change it to: 更改为:

systemLog:
  destination: file
  path: "d:\\mongodb\\log\\mongod.log"
net:
  port: 27018
storage:
  dbPath: "d:\\mongodb\\data\\db"

Alternatively you can also use mongod --dbpath "d:\\mongodb\\data\\db" 或者,您也可以使用mongod --dbpath "d:\\mongodb\\data\\db"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM