mongodb3.0无法使用我的配置文件运行

时间:2015-03-29 05:26:56

标签: mongodb

这是我的配置文件

systemLog:
    destination: file
    path: "D:\\Program Files\\MongoDB\\Server\\3.0\data\\log\\mongodb.log"
    logAppend: true
    verbosity: 1
storage:
    engine: wiredTiger
    journal:
        enabled: true
    dbPath: "D:\\Program Files\\MongoDB\\Server\\3.0\\data\\db"
    logPath: "D:\\Program Files\\MongoDB\\Server\3.0\\data\\log\\mongodb.log"
    directoryPerDB: true 
    wiredTiger: 
        engineConfig: 
            cacheSizeGB: 2
processManagement:
   fork: true
   windowsService: 
       serviceName: MongoDB
       displayName: MongoDB
       description: "MongoDB server version 3.0"
       serviceUser: ********
       servicePassword: *******
net:
   bindIp: 127.0.0.1
   port: 27017
   http: 
       enabled: true
setParameter:
   enableLocalhostAuthBypass: false
#vim:ft=yaml

我的操作系统是Windows 8.1 64bit.wen我启动mongod.exe但错误! 这是我的命令

>mongod -f "D:\Program Files\MongoDB\Server\3.0\etc\mongodb.conf"

这是错误消息

D:\Program Files\MongoDB\Server\3.0\bin>mongod -f "D:\Program Files\MongoDB\Server\3.0\etc\mongodb.conf"
2015-03-29T13:09:27.379+0800 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory D:\data\db\ not found., terminating
2015-03-29T13:09:27.380+0800 I CONTROL  [initandlisten] dbexit:  rc: 100
你可以帮我分析哪里出错了? 非常感谢。

1 个答案:

答案 0 :(得分:0)

sc.exe create MongoDB binPath= "\"D:\Program Files\MongoDB\Server\3.0\bin\mongod.exe\" --service --config=\"D:\Program Files\MongoDB\Server\3.0\etc\mongodb.conf\" --dbpath=\"D:\Program Files\MongoDB\Server\3.0\data\db\""  DisplayName= "MongoDB" start= "auto"

必须在启动时添加--dbpath配置

mongod --config "D:\Program Files\MongoDB\Server\3.0\etc\mongodb.conf" --dbpath "D:\Program Files\MongoDB\Server\3.0\data\db"