MongoDB mmap to wiredTiger migration
Migrate your existing mmap based MongoDB instance into a wiredTiger manually.
Starting with the major release 4.X.Y of Rocket.Chat, MongoDB has to be setup with a WiredTiger storage engine rather than the deprecated mmapv1 one. This is mandatory, if you plan to upgrade to one of the future Rocket.Chat versions and has to be prepared before initiating the application upgrade.
Requirements
MongoDB instance with mmap storage engine
Quick usage
Stop running Rocket.Chat
Create a database dump from the mmapv1 MongoDB (also to have a backup in place)
Stop mmapv1 MongoDB service, drop existing data files, start up with wiredTiger
Import the dump into the new wiredTiger MongoDB
Start Rocket.Chat
Detailed usage
Stop Rocket.Chat service to ensure a consistent database dump:
systemctl stop rocketchat
Create a database dump from the current mmapv1 MongoDB:
mongodump --archive=~/mmapdump.gz --gzip
Stop MongoDB service:
systemctl stop mongod
Delete the mmapv1 based data files of your existing MongoDB:
rm -rf /var/lib/mongodb/*
Adjust MongoDB configuration to make use of wiredTiger storage engine:
vi /etc/mongod.conf
[...] engine: wiredTiger [...]
Start MongoDB service again:
systemctl start mongod
If running with a Replica-Set in your mongo.conf initialize replica set
mongo --eval 'rs.initiate()'
Import dump back into (wiredTiger) MongoDB:
mongorestore --drop --archive=~/mmapdump.gz --gzip --noIndexRestore
Repair databases and rebuild indices:
mongo --eval 'db.repairDatabase()'
Start Rocket.Chat service:
systemctl start rocketchat