Mysql简单测试及脚本

 1、利用脚本进行测试

#!/bin/bash
INTERVAL=5
PREFIX=$INTERVAL-sec-status
RUNFILE=/home/benchmarks/running
mysql -e 'SHOW GLOBAL VARIABLES' >> mysql-variables
while test -e $RUNFILE;do
  file=$(date +%F_%I)
  sleep=$(date +%s.%N |awk "{print $INTERVAL - (\$1 % $INTERVAL)}")
  sleep $sleep
  ts="$(date +"TS $s.%N %F %T")"
  loadavg="(uptime)"
  echo "$ts $loadavg" >> $PREFIX-${file}-status
  mysql -e "SHOW GLOBAL STATUS" >> $PREFIX-${file}-status &
  echo "$ts $loadavg" >> $PREFIX-${file}-innodbstatus
  mysql -e "SHOW ENGINE INNODB STATUS\G" >> $PREFIX-${file}-innodbstatus &
  echo "$ts $loadavg" >> $PREFIX-${file}-processlist
  mysql -e "SHOW FULL PROCESSLIST\G" >>$PREFIX-${file}-processlist &
  echo $ts
done
echo EXITING because $RUNFILE does not exist.
 

2、利用mysqlslap命令进行测试

Mysql简单测试及脚本_第1张图片

参考资料:高性能mysql(第三版)

你可能感兴趣的:(mysql,脚本)