问题描述
将数据从Tokumx迁移到MonoDB的Percona服务器
Migrating Data from Tokumx To Percona Server For MonoDB
第1步:
本指南介绍如何将现有Percona TokuMX实例升级到MongoDB的Percona Server。需要以下JavaScript文件才能执行升级:
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
您可以从GitHub下载这些文件。
You can download those files from GitHub.
步骤2:
运行allDbStats.js脚本以记录迁移之前的数据库状态:
$ mongo ./allDbStats.js >〜/ allDbStats.before.out
Step 2 :Run the allDbStats.js script to record database state before migration: $ mongo ./allDbStats.js > ~/allDbStats.before.out
步骤3:
执行数据库转储:
$ mongodump --out / your / dump / path
Step 3 :Perform a dump of the database: $ mongodump --out /your/dump/path
步骤4:
执行索引转储:
$ ./tokumx_dump_indexes.js> / your / dump / path / tokumxIndexes .json
Step 4 :Perform a dump of the indexes: $ ./tokumx_dump_indexes.js > /your/dump/path/tokumxIndexes.json
第5步:
使用 --noIndexRestore开关恢复无索引的集合:
$ mongorestore --noIndexRestore / your / dump / path
Step 5 :Restore the collections without indexes using "--noIndexRestore" switch: $ mongorestore --noIndexRestore /your/dump/path
步骤6:
恢复索引(这可能需要一段时间)。此步骤将在插入之前删除集合的群集选项。
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 '
$./psmdb_restore_indexes.js --eval "data='/your/dump/path/tokumxIndexes.json' "
步骤7:
运行allDbStats.js脚本以记录迁移后的数据库状态:
Run the allDbStats.js script to record database state after migration:
mongo ./allDbStats.js > ~/allDbStats.after.out
这是我从Tokumx迁移到Percona的指南mongodb的服务器。在步骤6中,当我尝试还原索引时,出现以下错误:
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
无法加载:/tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js
failed to load: /tmp/tokumx2_to_psmdb3_migration-master/psmdb_restore_indexes.js
我们将欢迎任何帮助。
谢谢
Any help will be welcomed.Thanks
推荐答案
检查tokumxIndexes.json文件。运行tokumx_dump_indexes.js时,必须使用mongo shell参数--quiet,否则生成的json开头将包含shell序言。
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.
然后使用类似
如果存在序言,请从tokumxIndexes.json文件中删除这两行。
MongoDB shell版本:3.0.11-1.6
连接到:127.0.0.1:27017/test
Also if preamble is present delete these two lines from the tokumxIndexes.json file."MongoDB shell version: 3.0.11-1.6connecting to: 127.0.0.1:27017/test"
并再次运行脚本。
并再次运行脚本
$。/ psmdb_restore_indexes.js --eval data ='/ your / dump / path / tokumxIndexes.json
现在,此脚本将开始构建索引过程
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.
这篇关于从Mongodb 3.11的Tokumx 1.5迁移到Percona服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!