Search code examples
mongodbserverdatabase-migrationperconatokumx

Migration From Tokumx 1.5 To Percona Server For mongodb 3.11


Migrating Data from Tokumx To Percona Server For MonoDB

Step 1 : This guide describes how to upgrade existing Percona TokuMX instance to Percona Server for MongoDB. The following JavaScript files are required to perform the upgrade:

• allDbStats.js
• tokumx_dump_indexes.js
• psmdb_restore_indexes.js

You can download those files from GitHub.

Step 2 : Run the allDbStats.js script to record database state before migration: $ mongo ./allDbStats.js > ~/allDbStats.before.out

Step 3 : Perform a dump of the database: $ mongodump --out /your/dump/path

Step 4 : Perform a dump of the indexes: $ ./tokumx_dump_indexes.js > /your/dump/path/tokumxIndexes.json

Step 5 : Restore the collections without indexes using “--noIndexRestore” switch: $ mongorestore --noIndexRestore /your/dump/path

Step 6 : Restore the indexes (this may take a while). This step will remove clustering options to the collections before inserting.

$./psmdb_restore_indexes.js --eval "data='/your/dump/path/tokumxIndexes.json' "

Step 7 :

Run the allDbStats.js script to record database state after migration:

mongo ./allDbStats.js   >   ~/allDbStats.after.out

This is the guide i have found in the Migration from Tokumx to Percona server for mongodb. at step 6 when i try to restore indexes i get below mentioned error :

 /mnt/tokumx-bkup/tokumxIndexes.json
 2016-06-29T05:28:20.028+0000 E QUERY    SyntaxError: Unexpected identifier

  at /tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js:78:1 at               /mnt/tokumx-bkup/tokumxIndexes.json

 2016-06-29T05:28:20.028+0000 E QUERY    Error: error loading js file:    /mnt/tokumx-bkup/tokumxIndexes.json

  at /tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js:78:1 at    /tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js:78

failed to load: /tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js

Any help will be welcomed. Thanks


Solution

  • check the tokumxIndexes.json file. When tokumx_dump_indexes.js is run, the mongo shell parameter --quiet must be used or the resulting json will contain the shell preamble at the beginning.

    And check the file using something like http://jsonlint.com/

    Also if preamble is present delete these two lines from the tokumxIndexes.json file. "MongoDB shell version: 3.0.11-1.6 connecting to: 127.0.0.1:27017/test"

    and Run the script again. and Run the script again $./psmdb_restore_indexes.js --eval "data='/your/dump/path/tokumxIndexes.json' " Now this script will start build Index Process.