Single Server

This section explains how to do an offline data migration from basic MongoDB to Percona TokuMX, for a single server, converting the existing data in MongoDB to Percona TokuMX. Instructions

  1. Shut down basic MongoDB

    Shut down the existing MongoDB server to make sure you get a consistent backup.

  2. Take a backup

    Back up the MongoDB database with mongodump. You will need the dbpath from your command-line options or /etc/mongodb.conf (this is often /var/lib/mongodb), and you will need to choose a location for the backup (here, /var/lib/mongodb.backup).

    $ sudo mongodump --dbpath /var/lib/mongodb --out /var/lib/mongodb.backup

    Take a moment to transfer any important configuration from your basic MongoDB configuration file (usually /etc/mongodb.conf) to your Percona TokuMX configuration file (usually /etc/tokumx.conf).

  3. Uninstall MongoDB

    Uninstall MongoDB. You can also remove the old dbpath since you have a backup.

  4. Install Percona TokuMX

    Install Percona TokuMX from tarballs or from packages on all machines. If your distribution’s package automatically starts Percona TokuMX, stop it for now.

  5. Import the backup

    Import your backup with mongorestore. You do not need to specify dbpath, it will connect to the running server by default.

    $ mongorestore /var/lib/mongodb.backup
  6. Verify the migration

    Connect with the mongo command and verify that you’re connected to Percona TokuMX and your data has been migrated.

    > db.serverBuildInfo().tokumxVersion
    > show dbs
    ... Collection Options

For some data sets, it may make sense to use some of TokuMX’s Collection and Index Options for your migrated data.

You can use the new --defaultCompression, --defaultPageSize, and --defaultReadPageSize options to mongorestore to change the settings used to create newly loaded collections and indexes.


Advanced users can modify the metadata.json of any data dump before loading it to get full control of the indexing options after loading with mongorestore.

You can give collections a primaryKey, make secondary indexes clustering, even add or remove secondary indexes by editing that file.