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