directoryperDB 在 WiredTiger 存储引擎下无法工作

directoryperDB 在 WiredTiger 存储引擎下无法工作

当我在 mongo.conf 文件中启用 directoryperdb 选项时,mongodb 服务器服务无法启动。

2020-03-16T15:37:55.300+0530 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'

2020-03-16T15:37:55.671+0530 I  CONTROL  [main] Trying to start Windows service 'MongoDB'

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] MongoDB starting : pid=8776 port=27017 dbpath=C:\Program Files\MongoDB\Server\4.2\data 64-bit host=GGNUVBRESSCHINL

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] db version v4.2.0

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] allocator: tcmalloc

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] modules: none

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten] build environment:

2020-03-16T15:37:55.672+0530 I  CONTROL  [initandlisten]     distmod: 2012plus

2020-03-16T15:37:55.673+0530 I  CONTROL  [initandlisten]     distarch: x86_64

2020-03-16T15:37:55.673+0530 I  CONTROL  [initandlisten]     target_arch: x86_64

2020-03-16T15:37:55.673+0530 I  CONTROL  [initandlisten] options: { config: "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg", net: { bindIp: "127.0.0.1", port: 27017 }, service: true, storage: { dbPath: "C:\Program Files\MongoDB\Server\4.2\data", directoryPerDB: true, journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "C:\Program Files\MongoDB\Server\4.2\log\mongod.log" } }

2020-03-16T15:37:55.674+0530 I  STORAGE  [initandlisten] Detected data files in C:\Program Files\MongoDB\Server\4.2\data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.

2020-03-16T15:37:55.674+0530 I  STORAGE  [initandlisten] exception in initAndListen: InvalidOptions: Requested option conflicts with current storage engine option for directoryPerDB; you requested true but the current server storage is already set to false and cannot be changed, terminating

2020-03-16T15:37:55.675+0530 I  NETWORK  [serviceStopWorker] shutdown: going to close listening sockets...

2020-03-16T15:37:55.675+0530 I  -        [serviceStopWorker] Stopping further Flow Control ticket acquisitions.

2020-03-16T15:37:55.675+0530 I  CONTROL  [serviceStopWorker] now exiting

答案1

如果您有现有的数据文件,则无法更改影响磁盘上数据布局的设置(如directoryPerDBdirectoryForIndexes)。

启动日志中的错误消息指出了这一点:

InvalidOptions:请求的选项与 directoryPerDB 的当前存储引擎选项冲突;您请求 true,但当前服务器存储已设置为 false 且无法更改,终止

要更改现有部署的此选项,您需要mongodump更改mongorestore数据(对于独立部署)或通过复制进行滚动升级(对于副本集部署)。

查看文档diretoryPerDB了解如何为现有独立或副本集部署更改此选项的步骤。

相关内容