1.由于一个库上查询某些表的select比较慢 ,所以写了一个定时kill的脚本
#!/bin/bash
cd /app/devops/test/peizhiku-2.20-kill_zss1024;
zss_PASS=$(openssl enc -aes-256-cbc -d -a -salt -pass file:./.secret.key -in ./ES_pass.txt 2>/dev/null)
/app/mysql-install/bin/mysql -uroot -p$zss_PASS -h10.164.1.2 -P9089 -e “select * from information_schema.processlist where COMMAND not in ('Sleep') and user='root' and INFO like 'select%udal_monitor%' and TIME >60 and HOST not like '10.164.1.5%' order by TIMEG;” >select.txt
/app/mysql-install/bin/mysql -uroot -p$zss_PASS -h10.164.1.2 -P9089 -e “select concat('kill ',ID,';') from information_schema.processlist where COMMAND not in ('Sleep') and user='root' and INFO like 'select%udal_monitor%' and TIME >60 and HOST not like '10.164.1.5%' order by TIME ;” >mingling.txt 2>/dev/null
/usr/bin/grep -v concat mingling.txt >minglingtmp.txt
while IFS= read -r line
do
/app/mysql-install/bin/mysql -uroot -p$zss_PASS -h10.164.1.2 -P9089 -e “$line” >log.txt 2>/dev/null
done < minglingtmp.txt

2.另外还有一个脚本是定时备份这个库的,但是有如下报错:
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `zsstablexxxxxxx` at row: 112934

缘由分析:
定时备份任务被定时kill任务kill掉了
解决办法:
把执行备份脚本的主机IP过滤掉,sql中加上HOST not like '10.164.1.5%'(上面1中提供的脚本,是修改过的,)


