126.96.36.199. 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.
Shut down basic MongoDB
Shut down the existing MongoDB server to make sure you get a consistent backup.
Take a backup
Back up the MongoDB database with mongodump. You will need the
dbpathfrom 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,
$ 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
Uninstall MongoDB. You can also remove the old
dbpathsince you have a backup.
Install Percona TokuMX
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
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 2.0.0 > show dbs ...
188.8.131.52.2. 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
--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.