MongoDB 3.2配置文件directoryPerDB参数,无法重启

MongoDB3.2 使用过一段时间之后,想要配置下directoryPerDB参数,于是在mongod.conf配置文件storage下加入:

  directoryPerDB: true

服务重启时报错信息如下:

2016-07-21T02:47:14.007-0700 I CONTROL  [main] ***** SERVER RESTARTED *****
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] MongoDB starting : pid=2740 port=27017 dbpath=/home/martin/mongodb/db 64-bit host=localhost.localdomain
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] db version v3.2.8
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] allocator: tcmalloc
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] modules: enterprise 
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] build environment:
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten]     distmod: rhel62
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten]     distarch: x86_64
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2016-07-21T02:47:14.020-0700 I CONTROL  [initandlisten] options: { config: "/home/martin/mongodb/bin/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, processManagement: { fork: true, pidFilePath: "/home/martin/mongodb/mongod.pid" }, security: { authorization: "enabled" }, storage: { dbPath: "/home/martin/mongodb/db", directoryPerDB: true, journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/home/martin/mongodb/logs/mongod.log" } }
2016-07-21T02:47:14.041-0700 I -        [initandlisten] Detected data files in /home/martin/mongodb/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-07-21T02:47:14.042-0700 I STORAGE  [initandlisten] exception in initAndListen: 72 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
2016-07-21T02:47:14.042-0700 I CONTROL  [initandlisten] dbexit:  rc: 100

根据错误日志提示:

[initandlisten] exception in initAndListen: 72 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

初始化失败,当前directoryPerDB选项存储引擎有72个选项冲突,你要求true,但是当前存储服务已经设置为false,并且无法改变,程序终止。

解决办法:
1、删除dbPath文件夹下所有文件,重启MongoDB服务;
2、导出MongoDB 存储文件,删除dbPath文件夹下所有文件,重启MongoDB服务,导入导出的数据;
注意:仅支持测试环境,生产环境操作还请参考评论中解决办法!~

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值