-
Notifications
You must be signed in to change notification settings - Fork 96
Migrating Sharded Cluster Offline Individual Shards
This guide explains how to do an offline data migration from MongoDB to TokuMX, for a sharded cluster, converting the existing data in MongoDB to TokuMX on a shard-by-shard basis.
For other migration strategies, start with Migrating from MongoDB and Migrating from MongoDB: Sharded clusters.
-
Shut down the existing MongoDB servers on each machine in the sharded cluster (shards, config servers, and routers) to make sure you get a consistent backup.
-
Migrate each shard to TokuMX offline, following the guide Migrating from MongoDB: Replica set (offline). You can do this for each shard in parallel.
-
Back up one of the MongoDB config servers with
mongodump. You will need thedbpathfrom/etc/mongodb.conf(this is often/var/lib/mongodb) and you will need to choose a location for the backup (here,/var/lib/configdb.backup).One config server only:
$ sudo mongodump --dbpath /var/lib/mongodb --out /var/lib/configdb.backup - MongoDB latest version - $ sudo mongodump --out /var/lib/mongodb.backup -
Uninstall MongoDB from the config servers. You can also remove the old
dbpathsince you have a backup. -
Install TokuMX for your distribution on the config servers (instructions) and make sure it starts properly. Migrate any relevant configuration from
/etc/mongodb.confto/etc/tokumx.confand restart the config servers if necessary. -
Import the backup to each config server with
mongorestore. If you are running with theconfigsvroption, remember that this makes the port27019instead of the default.$ mongorestore --host localhost:27019 /var/lib/configdb.backup $ mongorestore --host cfg2.domain:27019 /var/lib/configdb.backup $ mongorestore --host cfg3.domain:27019 /var/lib/configdb.backup -
Copy any relevant configuration from
/etc/mongodb.confto/etc/tokumx.confon allmongosrouter machines. -
If your config servers have different hostnames now, you will need to update the
configdbsettings for all yourmongosconfigurations. See Migrate Config Servers with Different Hostnames for more details. -
If your shard servers have different hostnames now, you will need to update their hostnames in the config servers' databases. Connect to the config servers and update the shards' metadata.
$ mongo localhost:27019,cfg2.domain:27019,cfg3.domain:27019/config > db.shards.update({_id: <shard name>}, {$set: {host: "<replset name>/<hostnames>"}}) -
Start the TokuMX
mongosserver on all router machines, and start your application.