Changing the storage engine for a standalone MongoDB server from Mmapv1 to WiredTiger is relatively painless.
Here’s how I did it.
Backup the database
mongodump --out /srv/backup/mongodbStop monbodb service
service mongodb stopUpdate mongodb.conf. Here’s my /etc/mongodb.conf file:
# mongod.conf storage: dbPath: "/var/lib/mongo" engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 1 statisticsLogDelaySecs: 0 journalCompressor: snappy directoryForIndexes: false collectionConfig: blockCompressor: snappy indexConfig: prefixCompression: true systemLog: verbosity: 1 path: "/var/log/mongodb/mongod.log" logAppend: true logRotate: reopen destination: file timeStampFormat: iso8601-utc processManagement: fork: true pidFilePath: "/var/run/mongodb/mongod.pid" net: bindIp: 127.0.0.1 port: 27017 wireObjectCheck: false unixDomainSocket: enabled: trueStart monbodb service
service mongodb startRestore the database from backup
mongorestore /srv/backup/mongodb
That’s it.
To check what storage engine you’re using with your MongoDB, connect to the mongodb with mongo shell and run:
> db.serverStatus().storageEngine
{ "name" : "wiredTiger" }