12.1.1.6. Sharded Cluster Online

This guide explains how to do an online data migration from basic MongoDB to Percona TokuMX, for a sharded cluster, converting the existing data in MongoDB to Percona TokuMX on a shard-by-shard basis

For other migration strategies, start with Migrating to TokuMX.

12.1.1.6.1. Instructions

  1. Stop the balancer

    Turn off the balancer, and wait for any migrations to complete.

    On a mongos router:

    > sh.setBalancerState(false);
    > while (sh.isBalancerRunning()) {
    ...     print('waiting...');
    ...     sleep(1000);
    ... }
    
  2. Migrate shards

    Perform an online migration of each shard individually as a replica set, until all shards are caught up.

    Learn how in Replica Set Online (without downtime).

    Tip

    These migrations can be done concurrently.

  3. Keep syncing

    Leave one instance of mongo2toku running from each MongoDB shard to its corresponding Percona TokuMX shard.

  4. Shut down a config server

    Shut down one of the MongoDB config servers.

    This will not stop application reads and writes, but it will stop splits and chunk migrations from completing.

  5. Migrate the stopped config server

    Perform an offline migration of the shut down config server to Percona TokuMX, and import its backup once for each Percona TokuMX config server, to bring the set of Percona TokuMX config servers online.

    Note

    See Sharded Cluster Offline: Individual Shards for details on how to handle shard and config server hostname changes when migrating MongoDB sharded cluster config data.

  6. Start Percona TokuMX routers

    Start Percona TokuMX mongos routers on the TokuMX config servers.

    In the last step, the config data should have been modified so that the new mongos routers can find the Percona TokuMX shards, you can check sh.status() at this point on the Percona TokuMX cluster to verify that everything is working normally.

  7. Pause and wait for full sync

    Pause your application’s writes and wait for all mongo2toku processes to report that they are “fully synced”.

  8. Switch your application to Percona TokuMX

    Redirect your application to the Percona TokuMX mongos routers.

  9. Clean up and tear down basic MongoDB

    Once your application is running on the Percona TokuMX cluster, you can stop all the mongo2toku processes, the remaining MongoDB config servers, the MongoDB shard servers, and the MongoDB router servers, delete the MongoDB dbpaths, and shut down those machines.