- 论坛徽章:
- 9
|
# NOTE: depending on your version of MySQL
## This example is for mysql 5.4
Shell> for x in var=`cat mysql.log |grep Connect |awk '{print $2}' |cut -d: -f3`; do echo ${var:2:50} >> out.txt; done
I now have all of the connection ids for the database I want to
benchmark. From here I need to parse through the mysql.log (the general
log) to get the queries that I would like to run with mysqlslap. Here
goes:
Shell> for x in `cat ./out.txt`; do cat mysql.log | awk -v x="$x" '{ if ( $1 == x ) { printf("%s ;\n",$0,x) } }' $1; done |awk -FQuery '{print $2 “ ;”}' |grep –v “INSERT” >> myqueries.txt
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/90603/showart_2058282.html |
|