Mongodb directoryperDB在WiredTiger存储引擎下不工作
当我在mongo.conf文件中启用directoryperdb选项时,mongodb服务器服务不会启动 它说Mongodb directoryperDB在WiredTiger存储引擎下不工作,mongodb,wiredtiger,Mongodb,Wiredtiger,当我在mongo.conf文件中启用directoryperdb选项时,mongodb服务器服务不会启动 它说directotyperdb值不能为true 以下是mongo日志:- 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:3
directotyperdb值不能为true
以下是mongo日志:-
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
如果服务器在没有此参数的情况下已经启动,您将无法在之后更改它,这是因为元数据文件已经存在,如果您可以删除数据,请删除数据文件夹内容并重试,它将工作 根据文档,如果要为现有服务器执行此操作,则需要执行以下操作: 要更改现有部署的storage.directoryPerDB选项,请执行以下操作:
For standalone instances:
Use mongodump on the existing mongod instance to generate a backup.
Stop the mongod instance.
Add the storage.directoryPerDB value and configure a new data directory
Restart the mongod instance.
Use mongorestore to populate the new data directory.
For replica sets:
Stop a secondary member.
Add the storage.directoryPerDB value and configure a new data directory to that secondary member.
Restart that secondary.
Use initial sync to populate the new data directory.
Update remaining secondaries in the same fashion.
Step down the primary, and update the stepped-down member in the same fashion.
这里解释如下: