maatkit工具校验mysql主从数据一致性

#!/bin/bash
masterip=${1}
masterport=${2}
slaveip=${3}
slaveport=${4}
cat /dev/null > ${slaveip}_${slaveport}_check_result
for onedb in `mysql -h ${masterip} -P${masterport} -uxx-pxxxx -s -e "show databases" | grep -v -E "information_schema|mysql|performance_schema|sys|innodb|tmp"`
do
mysql -h ${masterip} -P${masterport} -uxx -pxxxx -s ${onedb} -e "show tables" > ${slaveip}_${slaveport}_tablelist
for onetab in `cat ${slaveip}_${slaveport}_tablelist`
do
echo `date`" check ${onedb} ${onetab}" >> ${slaveip}_${slaveport}_check_result
/var/hunter/mysql/maatkit/mk-table-checksum --chunk-size=100000 --algorithm=BIT_XOR -d ${onedb} -t ${onetab} h=${masterip},P=${masterport},u=xx,p=xxxx h=${slaveip},P=${slaveport},u=xx,p=xxxx | /var/hunter/mysql/maatkit/mk-checksum-filter >> ${slaveip}_${slaveport}_check_result
done
done

上一篇:Android进阶系列之源码分析Activity的启动流程


下一篇:ftp断点续传