估计程序里面还是有点问题,经常造成大面积的同步出错,出错信息基本上是那种主键冲突之类的.
经常要几十台几十台的这样跳错太烦了,写了个shell.
#!/bin/sh while [ "0" != $(mysql -h 127.0.0.1 -u yemaosheng_com -ppasswd -e "show slave status\G" | grep "Seconds_Behind_Master: " | awk -F ': ' '{print $2}') ]; do if [ 0 -lt $(mysql -h 127.0.0.1 -u yemaosheng_com -ppasswd -e "show slave status\G" | grep "Last_Error: Error" | wc -l) ]; then mysql -h 127.0.0.1 -u yemaosheng_com -ppasswd -e "SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;slave start;"; fi done |