简体   繁体   English

mongodb忽略dbPath参数?

[英]mongodb ignores dbPath parameter?

I installed Mongodb latest (4.0) as a service on Windows 10 我在Windows 10上将Mongodb最新(4.0)安装为服务
It seems like its ignoring the mongod.cfg file in the bin directory 似乎它忽略了bin目录中的mongod.cfg文件

C:\MongoDB4.0\bin\mongod.cfg
# Where and how to store data.
 storage:
     dbPath: C:\MongoDB4.0\data

The service will not start, 该服务将无法启动,
When I start it from CMD like: 当我从CMD启动它时:

c:\MongoDB4.0\bin>mongod.exe

This is its output: (see dbpath=c:\\data\\db) 这是它的输出:(请参见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

I see that the service gets the configuration as a parameter 我看到该服务将配置作为参数

C:\\MongoDB4.0\\bin\\mongod.exe --config "C:\\MongoDB4.0\\bin\\mongod.cfg" --service C:\\ MongoDB4.0 \\ bin \\ mongod.exe --config“ C:\\ MongoDB4.0 \\ bin \\ mongod.cfg”-服务

服务器道具

The --service option is used to create the initial service definition, and should generally not be required if you are using a MongoDB 4.0+ installer (which includes this step during installation). --service选项用于创建初始服务定义,如果您使用的是MongoDB 4.0+安装程序(在安装过程中包括此步骤),通常不需要使用该选项。

To manage the MongoDB service from the command line you need to use net start MongoDB and net stop MongoDB . 要从命令行管理MongoDB服务,您需要使用net start MongoDBnet stop MongoDB

c:\\MongoDB4.0\\bin>mongod.exe C:\\ MongoDB4.0 \\ BIN> mongod.exe

If you run mongod.exe without any parameters the default values will be used (such as c:\\data\\db for the dbPath ). 如果运行不带任何参数的mongod.exe ,将使用默认值(例如dbPath c:\\data\\db )。 The server binary does not currently have a default location for a configuration file. 服务器二进制文件当前没有配置文件的默认位置。

There's a relevant feature request to watch/upvote in the MongoDB issue tracker: SERVER-36150: Improved Default Config File Handling . MongoDB问题跟踪器中有一个相关的功能请求,需要监视/ 投票:SERVER-36150:改进的默认配置文件处理

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

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