سؤال

I am trying to install MongoDB on Windows Azure VM which is running Windows 2012 Server

  1. I have mongodb in C:\Program Files\MongoDB\bin
  2. I have config file at 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.

Then I tried c:\Program Files\MongoDB\bin>mongod --config "D:\mongodb\mongod.cfg" --install that give me bellow message

2014-05-02xxxxxx log file "d:mongodb\log\mongod.log" exists; moved to "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. But in my config file i gave the path as dbpath=d:\mongodb\data\db

Changed my config file to 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.

هل كانت مفيدة؟

المحلول

Your config file has wrong syntax (it uses YAML syntax). 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"

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top