Mysqlパフォーマンスモニタリング
2834 ワード
mysql
mysqladmin -uroot -h127.0.0.1 -p123456 processlist |awk -F "|" '{print $2}' | xargs -n 1 mysqladmin -uroot -p123456 kill
joe
mysqladmin -uroot -h127.0.0.1 -p123456 processlist | awk -F "|" '{if($3 == "joe")print $2}'|xargs -n 1 mysqladmin -uroot -p123456 kill
show engine innodb status;
grep -r -E
mysqladmin -p123456 extended-status -ri1|grep -r -E 'Queries|Threads_connected|Threads_running'
queries
mysqladmin -uroot -p123456 ext|awk '/Queries/{printf("%d",$4)}'
Queries Threads_connected Threads_running
mysqladmin -uroot -p123456 ext|awk '/Queries/{printf("%d ",$4)}/Threads_connected/{printf("%d ",$4)}/Threads_running/{printf("%d
",$4)}'
MySQL http://www.jb51.net/article/53900.htm
mysqladmin -P3306 -uroot -ppassword -h127.0.0.1 -r -i 1 ext |\
awk -F"|" \
"BEGIN{ count=0; }"\
'{ if($2 ~ /Variable_name/ && ++count == 1){\
print "----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --";\
print "---Time---|---QPS---|select insert update delete| read inserted updated deleted| logical physical";\
}\
else if ($2 ~ /Queries/){queries=$3;}\
else if ($2 ~ /Com_select /){com_select=$3;}\
else if ($2 ~ /Com_insert /){com_insert=$3;}\
else if ($2 ~ /Com_update /){com_update=$3;}\
else if ($2 ~ /Com_delete /){com_delete=$3;}\
else if ($2 ~ /Innodb_rows_read/){innodb_rows_read=$3;}\
else if ($2 ~ /Innodb_rows_deleted/){innodb_rows_deleted=$3;}\
else if ($2 ~ /Innodb_rows_inserted/){innodb_rows_inserted=$3;}\
else if ($2 ~ /Innodb_rows_updated/){innodb_rows_updated=$3;}\
else if ($2 ~ /Innodb_buffer_pool_read_requests/){innodb_lor=$3;}\
else if ($2 ~ /Innodb_buffer_pool_reads/){innodb_phr=$3;}\
else if ($2 ~ /Uptime / && count >= 2){\
printf(" %s |%9d",strftime("%H:%M:%S"),queries);\
printf("|%6d %6d %6d %6d",com_select,com_insert,com_update,com_delete);\
printf("|%6d %8d %7d %7d",innodb_rows_read,innodb_rows_inserted,innodb_rows_updated,innodb_rows_deleted);\
printf("|%10d %11d
",innodb_lor,innodb_phr);\
}}'
----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --
---Time---|---QPS---|select insert update delete| read inserted updated deleted| logical physical
16:38:56 | 3003| 694 1 0 0| 38940 1 0 0| 115619 0
16:38:57 | 100| 27 0 0 0| 29 0 0 0| 53 0
mysql -e
mysql -p123456 -e "use owl-test;show tables"
explain type index, Mysql