0

I recently upgraded an Ubuntu 14 server to 16, and now I'm unable to start the MongoDB service.

I'm using MongoDB 3.4, from Mongo's Xenial PPA at http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4.

If I run:

sudo rm -Rf /var/log/mongodb/*
sudo service mongodb start

and then wait a few minutes, and in /var/log/mongodb/mongodb.log I see:

2018-02-06T17:42:07.322+0000 [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /var/lib/mongodb created by storage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminating

I'm assuming the default storage engine changed between releases, from "wiredTiger" to "mmapv1"? How do I set the storage engine back to "wiredTiger"?

If I add:

storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  engine: wiredTiger

to my /etc/mongod.conf, I get the same error. If I try adding that to my /etc/mongodb.conf, I get the error:

Error parsing INI config file: the options configuration file contains an invalid line 'storage:'
Cerin
  • 3,497
  • 17
  • 57
  • 72
  • Mongo storage format changed with version 3, maybe that's the reason. Maybe you need to dump old db with old version, delete it, start mongod 3 and reimport it. – Andrew Smith Feb 06 '18 at 17:47
  • @AndrewSmith I don't understand. It's saying the old database is written with "wiredTiger". That format is still supported in version 3.*. – Cerin Feb 06 '18 at 18:02
  • ok, then maybe it's something else – Andrew Smith Feb 06 '18 at 18:52
  • 1
    IIRC wiredTiger *replaced* mmapv1 as the default storage engine in v3. It looks like you are trying to run an old version of mongodb against a database created by a newer version. – symcbean Feb 06 '18 at 21:29

1 Answers1

1

According to reference documentation storage section should look like this:

engine: <string>
   mmapv1:
      preallocDataFiles: <boolean>
      nsSize: <int>
      quota:
         enforced: <boolean>
         maxFilesPerDB: <int>
      smallFiles: <boolean>
      journal:
         debugFlags: <int>
         commitIntervalMs: <num>
   wiredTiger:
      engineConfig:
         cacheSizeGB: <number>
         journalCompressor: <string>
         directoryForIndexes: <boolean>
      collectionConfig:
         blockCompressor: <string>
      indexConfig:
         prefixCompression: <boolean>

Your piece looks slightly different. You may try to change your section for snippet below for the sake of testing and see if it's start. This piece is working on mongo 3.4 server right now:

storage:
  dbPath: /my/data/path
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

Also if it won't help and you still get error parsing INI file, you may want to check whole file against reference documentation. And i suggest you trying to run mongodb -vvv -f /path/to/config to see if mongodb is still using your config file.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47