Using MySQL + xargs to restore a Mydumper backup

Split the restore, first the schema, then the data:


dump# ls my_database.* | grep schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"
dump# ls my_database.* | grep -v schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"

Skip restoring data for a few tables:


dump# ls my_database.* | egrep -v 'tbl_a|tbl_b|tbl_c' | grep -v schema | xargs -I % -n 1 bash -c "mysql anotherDB < %"

Reference: http://www.dctrwatson.com/2010/07/using-mydumper-to-parallel-dumpimport-fromto-mysql/

Similar Posts:

Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *