- Print
- DarkLight
- PDF
Migrate from mmap to WiredTiger Storage Engine
- Print
- DarkLight
- PDF
Starting with the major release 4.x of Rocket.Chat, MongoDB has to be set up 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 have to be prepared before initiating the application upgrade.
This guide helps you migrate your existing mmap
based MongoDB instance to WiredTiger manually.
Requirements
MongoDB instance with mmap storage engine.
Quick usage
Following is an overview of the migration steps:
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, and start up with WiredTiger.
Import the dump into the new WiredTiger MongoDB.
Start Rocket.Chat.
Detailed usage
Here are the detailed steps of the migration process:
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