我在Windows10上安装了Mongodb latest (4.0)作为服务
它似乎忽略了bin目录中的mongod.cfg文件
C:\MongoDB4.0\bin\mongod.cfg
# Where and how to store data.
storage:
dbPath: C:\MongoDB4.0\data该服务将不会启动,
当我从CMD启动时,如下所示:
c:\MongoDB4.0\bin>mongod.exe这是它的输出:(参见dbpath=c:\data\db)
Log: [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
Log: [initandlisten] MongoDB starting : pid=7104 port=27017 dbpath=c:\data\db\ 64-bit host=Win10-Pc
Log: [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
Log: [initandlisten] db version v4.0.2
Log: [initandlisten] git version: fc1573ba18aee42f97a3bb13b67af7d837826b47我看到该服务将配置作为参数获取
C:\MongoDB4.0\bin\mongod.exe --配置"C:\MongoDB4.0\bin\mongod.cfg“--服务

发布于 2018-09-19 04:31:30
要从命令行管理MongoDB服务,您需要使用net start MongoDB和net stop MongoDB。
c:\MongoDB4.0\bin>mongod.exe
如果在不带任何参数的情况下运行mongod.exe,将使用默认值(例如dbPath的c:\data\db )。服务器二进制文件当前没有配置文件的默认位置。
在MongoDB问题跟踪器中有一个相关的特性请求:SERVER-36150: Improved Default Config File Handling。
https://stackoverflow.com/questions/52390046
复制相似问题