12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-03 12:11:22
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
分享一个好用的性能分析shell脚本,也适用于mysql8.0版本:# mysqladmin -P3306 -uroot -p -r -i 1 ext |\awk -F"|" \"BEGIN{ count=0; }"\'{ if($2 ~ /Variable_name/ &&
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
分享一个好用的性能分析shell脚本,也适用于mysql8.0版本:
# mysqladmin -P3306 -uroot -p -r -i 1 ext |\
awk -F"|" \
"BEGIN{ count=0; }"\
'{ if($2 ~ /Variable_name/ && ((++count)%20 == 1)){\
print "----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --";\
print "---Time---|---QPS---|select insert update delete| read inserted updated deleted| logicalphysical";\
}\
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\n",innodb_lor,innodb_phr);\
}}'
Enter password:
----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --
---Time---|---QPS---|select insert update delete| read inserted updated deleted| logicalphysical
14:31:40 |4789| 479 1831 0 0| 44042116 0 0|50198498
14:31:41 |10102| 841 3869 0 0| 117414575 0 0|101467980
14:31:42 |10722| 980 4076 0 0| 128694748 0 0|1105501023
14:31:44 |8935| 785 3419 1 0| 134133994 1 0|1065591112
14:31:45 |9681| 828 3710 0 0| 95304370 0 0|943691223
14:31:46 |10258| 981 3840 0 0|2886684513 0 0|137434992
14:31:47 |10414| 919 4027 1 0| 260744745 1 0|1519241032
14:31:48 |9365| 846 3558 0 0| 63094217 0 0|80498956
14:31:49 |10592| 941 4014 0 0| 95574692 0 0|981961010
14:31:50 |9338| 850 3583 0 0| 853774249 0 0|1047681013
14:31:51 |11355| 1005 4392 1 0| 49695140 1 0|92914966
14:31:52 |10869| 888 4323 0 0| 275145035 0 0|902111088
14:31:53 |8975| 800 3408 0 0| 419494074 0 0|998291006
14:31:54 |9599| 829 3655 0 0| 437824302 0 0|1878231052
14:31:55 |9813| 870 3737 0 0| 148614410 0 0|1117231302
14:31:56 |9929| 875 3806 0 0| 130994497 0 0|96647934
14:31:57 |10534| 1502 3810 0 0| 980514468 0 0|174053971
14:31:58 |11310| 2508 3714 0 0|1446814378 0 0|180342951
14:31:58 |11564| 2619 3774 0 0| 188414453 0 0|144142914
----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --
---Time---|---QPS---|select insert update delete| read inserted updated deleted| logicalphysical
14:31:59 |6420| 914 2256 1 0|3409032525 1 0|239705957
14:32:00 |9437| 800 3605 0 0| 335334268 0 0|1698351312
14:32:01 |9891| 1679 3542 0 0| 249794140 0 0|153787908
14:32:02 |12949| 2733 4390 1 0| 510195059 1 0|258339942
14:32:04 |11818| 2646 3861 0 0| 448414564 0 0|225847898
14:32:05 |9910| 1178 3646 0 0| 435314317 0 0|2081281293
14:32:06 |11548| 2701 3654 0 0|1016524299 0 0|1660211776
14:32:07 |12025| 2714 3852 0 0|2405764548 0 0|255133889
14:32:08 |10443| 1094 3877 0 0|1346564605 0 0|492296838
14:32:09 |11780| 2560 3847 0 0| 602534533 0 0|275701683
14:32:10 |10082| 2404 3244 0 0| 353073785 0 0|186048416
14:32:11 |10731| 1417 3839 0 0| 724114445 0 0|305717810
14:32:12 |11018| 2434 3569 0 0|2811514222 0 0|323895835
14:32:13 |10911| 2375 3590 0 0|1374974248 0 0|514110571
14:32:14 |10269| 913 3943 0 0|2187824645 0 0|759658448
14:32:15 |10752| 974 4114 0 0|2192354864 0 0|762128341
14:32:16 |9767| 924 3731 0 0|3056914378 0 0|851373285
14:32:17 |10279| 862 3907 0 0|1293544622 0 0|473603734
14:32:18 |9199| 803 3539 0 0|3122884211 0 0|359733708
14:32:18 |9625| 839 3694 0 0| 21124357 0 0|68472970
----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --
........................................................................................................................................................................................................................
........................................................................................................................................................................................................................
........................................................................................................................................................................................................................
........................................................................................................................................................................................................................
........................................................................................................................................................................................................................
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19