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.
If you are using a Docker setup, click here to find an alternative article in our docs about migration.

Requirements

    MongoDB instance with mmap storage engine

Quick usage

    1.
    Stop running Rocket.Chat
    2.
    Create a database dump from the mmapv1 MongoDB (also to have a backup in place)
    3.
    Stop mmapv1 MongoDB service, drop existing data files, start up with wiredTiger
    4.
    Import the dump into the new wiredTiger MongoDB
    5.
    Start Rocket.Chat

Detailed usage

    1.
    Stop Rocket.Chat service to ensure a consistent database dump:
    1
    systemctl stop rocketchat
    Copied!
    2.
    Create a database dump from the current mmapv1 MongoDB:
    1
    mongodump --archive=~/mmapdump.gz --gzip
    Copied!
    3.
    Stop MongoDB service:
    1
    systemctl stop mongod
    Copied!
    4.
    Delete the mmapv1 based data files of your existing MongoDB:
    1
    rm -rf /var/lib/mongodb/*
    Copied!
    5.
    Adjust MongoDB configuration to make use of wiredTiger storage engine:
    1
    vi /etc/mongod.conf
    Copied!
    1
    [...]
    2
    engine: wiredTiger
    3
    [...]
    Copied!
    6.
    Start MongoDB service again:
    1
    systemctl start mongod
    Copied!
    7.
    If running with a Replica-Set in your mongo.conf initialize replica set
    1
    mongo --eval 'rs.initiate()'
    Copied!
    8.
    Import dump back into (wiredTiger) MongoDB:
    1
    mongorestore --drop --archive=~/mmapdump.gz --gzip --noIndexRestore
    Copied!
    9.
    Repair databases and rebuild indices:
    1
    mongo --eval 'db.repairDatabase()'
    Copied!
    10.
    Start Rocket.Chat service:
    1
    systemctl start rocketchat
    Copied!
Last modified 1mo ago
Export as PDF
Copy link