Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Latest commit

 

History

History
80 lines (60 loc) · 2.09 KB

File metadata and controls

80 lines (60 loc) · 2.09 KB
description
Migrate your existing mmap based MongoDB instance into a wiredTiger manually.

MongoDB mmap to wiredTiger migration

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:

    systemctl stop rocketchat
    
  2. Create a database dump from the current mmapv1 MongoDB:

    mongodump --archive=~/mmapdump.gz --gzip
    
  3. Stop MongoDB service:

    systemctl stop mongod
    
  4. Delete the mmapv1 based data files of your existing MongoDB:

    rm -rf /var/lib/mongodb/*
    
  5. Adjust MongoDB configuration to make use of wiredTiger storage engine:

    vi /etc/mongod.conf
    
    [...]
    engine: wiredTiger
    [...]
    
  6. Start MongoDB service again:

    systemctl start mongod
    
  7. If running with a Replica-Set in your mongo.conf initialize replica set

    mongo --eval 'rs.initiate()'
    
  8. Import dump back into (wiredTiger) MongoDB:

    mongorestore --drop --archive=~/mmapdump.gz --gzip --noIndexRestore
    
  9. Repair databases and rebuild indices:

    mongo --eval 'db.repairDatabase()'
    
  10. Start Rocket.Chat service:

    systemctl start rocketchat