mysql参数怎么调是个问题,如果是Oracle,数据库报告上有很多建议,非常直观。mysql也有一个小工具mysqlreport,来统计一些信息指导调参数,最好是写一个任务,一个小时执行一次,这样可以看到高峰、低峰时期的统计信息,更有利于参数调优。
1.先下载dbi、dbd-mysql、mysqlreport-3.5。
[root@VM-10 mysqlreport-3.5]# ./mysqlreport --user root --password root --host 10.10.15.208 --port 3316 Use of uninitialized value in formline at ./mysqlreport line 1099. Use of uninitialized value $is in multiplication (*) at ./mysqlreport line 829. Use of uninitialized value in formline at ./mysqlreport line 1227. Use of uninitialized value in formline at ./mysqlreport line 1235. MySQL 5.6.25-log uptime 0 5:34:3 Wed Aug 26 17:12:54 2015 __ Key _________________________________________________________________ Buffer used 0 of 2.00G %Used: 0.00 Current 373.45M %Usage: 18.24 Write hit 0.00% Read hit 0.00% __ Questions ___________________________________________________________ Total 757 0.0/s Com_ 1.26k 0.1/s %Total: 166.31 -Unknown 805 0.0/s 106.34 DMS 294 0.0/s 38.84 COM_QUIT 9 0.0/s 1.19 Slow 5 s 13 0.0/s 1.72 %DMS: 4.42 Log: DMS 294 0.0/s 38.84 SELECT 294 0.0/s 38.84 100.00 REPLACE 0 0/s 0.00 0.00 DELETE 0 0/s 0.00 0.00 INSERT 0 0/s 0.00 0.00 UPDATE 0 0/s 0.00 0.00 Com_ 1.26k 0.1/s 166.31 admin_comma 800 0.0/s 105.68 show_table_ 171 0.0/s 22.59 set_option 148 0.0/s 19.55 __ SELECT and Sort _____________________________________________________ Scan 337 0.0/s %SELECT: 114.63 Range 51 0.0/s 17.35 Full join 0 0/s 0.00 Range check 0 0/s 0.00 Full rng join 0 0/s 0.00 Sort scan 64 0.0/s Sort range 1 0.0/s Sort mrg pass 32 0.0/s __ Query Cache _________________________________________________________ Memory usage 16.81k of 1.00M %Used: 1.64 Block Fragmnt 100.00% Hits 0 0/s Inserts 1 0.0/s Insrt:Prune 1:1 0/s Hit:Insert 0.00:1 __ Table Locks _________________________________________________________ Waited 0 0/s %Total: 0.00 Immediate 208 0.0/s __ Tables ______________________________________________________________ Open 1 of 2000 %Cache: 0.05 Opened 240 0.0/s __ Connections _________________________________________________________ Max used 4 of 1000 %Max: 0.40 Total 15 0.0/s __ Created Temp ________________________________________________________ Disk table 20 0.0/s Table 472 0.0/s Size: 16.0M File 67 0.0/s __ Threads _____________________________________________________________ Running 1 of 2 Cached 2 of 18 %Hit: 73.33 Created 4 0.0/s Slow 0 0/s __ Aborted _____________________________________________________________ Clients 8 0.0/s Connects 0 0/s __ Bytes _______________________________________________________________ Sent 504.65M 25.2k/s Received 51.91k 2.6/s __ InnoDB Buffer Pool __________________________________________________ Usage 127.98M of 127.98M %Used: 100.00 Read hit 97.36% Pages Free 0 %Total: 0.00 Data 7.87k 96.12 %Drty: 0.00 Misc 318 3.88 Latched 0.00 Reads 92.16M 4.6k/s From file 2.43M 121.3/s 2.64 Ahead Rnd 0 0/s Ahead Sql 0/s Writes 134 0.0/s Flushes 134 0.0/s Wait Free 0 0/s __ InnoDB Lock _________________________________________________________ Waits 0 0/s Current 0 Time acquiring Total 0 ms Average 0 ms Max 0 ms __ InnoDB Data, Pages, Rows ____________________________________________ Data Reads 2.46M 122.8/s Writes 87 0.0/s fsync 11 0.0/s Pending Reads 0 Writes 0 fsync 0 Pages Created 0 0/s Read 3.54M 176.9/s Written 134 0.0/s Rows Deleted 0 0/s Inserted 0 0/s Read 65.10M 3.2k/s Updated 0 0/s