Powered By Blogger

Wednesday, 1 June 2011

steps for download the maatkit tools

wget http://maatkit.googlecode.com/files/maatkit-7486.tar.gz
tar -zxf  maatkit-7486.tar.gz
cd maatkit-7486
perl Makefile.PL
make install

###################
Taking the backup of the Database "test" and store in "/home/kiran.chinta/test"
mk-parallel-dump -h'localhost' --no-gzip --databases 'test' -P 3306 --base-dir '/home/kiran/chinta/test'

Taking the backup of the Database "test" and ignoring the table staring with temp and test
mk-parallel-dump -h'localhost' --no-gzip --databases 'test' -P 3306 --base-dir '/home/kiran/chinta/test'  --ignore-tables-regex 'temp|test'
mk-parallel-dump -h'localhost' --chunk-size 10000 --threads 8 --no-gzip --databases 'test' -P 3306 --base-dir '/home/kiran.chinta/test'  --ignore-tables-regex 'temp|test'
mk-parallel-dump -h'localhost' --chunk-size 10000 --threads 8 --no-gzip --databases-regex 'test|test1' -P 3306 --base-dir '/home/kiran.chinta/test'  --ignore-tables-regex 'temp|test'

restoring the databases
/usr/bin/mk-parallel-restore -h'localhost' --database 'test'  '/home/kiran.chinta/test'
Restoring the single table
/usr/bin/mk-parallel-restore -h'localhost' --database 'test' --tables 'heartbeat' '/home/kiran.chinta/test'

To check wheather the two databases are in synch or not

/usr/bin/mk-table-checksum h=x.x.x.1 ,u=kiran ,p=kiran ,P=3306 --databases test h=x.x.x.2 ,u=kiran ,p=kiran ,P=3306 --databases test | mk-checksum-filter

The shell script to check wheather the two databases are in sych
#/bin/sh
for each db in `mysqlshow`
do
mk-table-checksum h=localhost,u=root,P=3306 --databases $db h=x.x.x.001,u=root,P=3306 --databases $db --no-crc --count | mk-checksum-filter
done


To know more see the urls below
http://www.maatkit.org/doc/mk-parallel-dump.html
http://www.maatkit.org/doc/maatkit.html

No comments:

Post a Comment