Created
January 26, 2014 15:12
-
-
Save shantanuo/8634172 to your computer and use it in GitHub Desktop.
Copy toku database to another server without using dump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# copy the database source files to destination | |
dbname='palus' | |
source='/DATA/4GLV/tokudb/' | |
destip='192.168.150.137' | |
destuser='db' | |
destpass='db' | |
destport='3306' | |
destination="root@$destip:/mnt/data2/" | |
time mysqldump --databases $dbname --no-data | mysql -h$destip -u$destuser -p$destpass -P$destport | |
if [[ $? -eq 0 ]];then | |
mysql -Bse"SELECT CONCAT(' scp $source ', SUBSTR(internal_file_name, 3, 255), ' $destination ') FROM information_schema.TokuDB_file_map WHERE \`database\` = \"$dbname\"" > to_move.txt | |
fi | |
exit |
Also the table's database column is now called table_schema, so change:
WHERE database
to
WHERE table_schema
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have the rename command available, you can use that:
rename 51fdda 2c3cd *tokudb
If you do not have the rename command available, you can do this with a simple loop:
for file in 51fdda.tokudb; do
mv ${file} ${file/51fdda/2c3cd}
done