更多博文請關注:沒有傘的孩子必須努力奔跑 (www.xuchanggang.cn)html
我的感受,這腳本很是不錯,能夠很直觀的發現,參數配置上的問題:mysql
下載地址爲:http://www.day32.com/MySQL/tuning-primer.sh web
下面安裝,演示一下:sql
1.安裝的話,若是能連外網,直接使用以下命令(不能鏈接外網,就先下來再使用)less
[root@10-9-7-79 test]# wget http://www.day32.com/MySQL/tuning-primer.sh socket
2.給予腳本執行權限:ide
[root@10-9-7-79 test]# chmod 755 tuning-primer.sh 測試
3.執行tuning-primer.sh 腳本:this
[root@10-9-7-79 test]# ./tuning-primer.sh
spa
4.下面就是測試結果:[測試結果內容,主要看每一個測試結果的最後幾行,特別注意內存這塊,這塊很容易就配置超出內存]
Using login values from ~/.my.cnf
- INITIAL LOGIN ATTEMPT FAILED -
Testing for stored webmin passwords:
None Found
Could not auto detect login info!
Found potential sockets: /tmp/mysql.sock
Using: /tmp/mysql.sock
# 如下這幾項須要輸入的,相信各位都能看得懂,就不解釋
Would you like to provide a different socket?: [y/N] nDo you have your login handy ? [y/N] : yUser: rootPassword: 122345Would you like me to create a ~/.my.cnf file for you? [y/N] : n -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery -MySQL Version 5.5.37-log x86_64Uptime = 5 days 4 hrs 11 min 46 secAvg. qps = 0Total Questions = 13261Threads Connected = 1Server has been running for over 48hrs.It should be safe to follow these recommendationsTo find out more information on how each of theseruntime variables effects performance visit:http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.htmlVisit http://www.mysql.com/products/enterprise/advisors.htmlfor info about MySQL's Enterprise Monitoring and Advisory ServiceSLOW QUERIESThe slow query log is enabled.Current long_query_time = 1.000000 sec.You have 1533 out of 13282 that take longer than 1.000000 sec. to completeYour long_query_time seems to be fineBINARY UPDATE LOGThe binary update log is enabledBinlog sync is not enabled, you could loose binlog records during a server crashWORKER THREADSCurrent thread_cache_size = 512Current threads_cached = 5Current threads_per_sec = 0Historic threads_per_sec = 0Your thread_cache_size is fineMAX CONNECTIONSCurrent max_connections = 1000Current threads_connected = 1Historic max_used_connections = 6The number of used connections is 0% of the configured maximum.You are using less than 10% of your configured max_connections.Lowering max_connections could help to avoid an over-allocation of memorySee "MEMORY USAGE" section to make sure you are not over-allocatingINNODB STATUSCurrent InnoDB index space = 160 MCurrent InnoDB data space = 2.10 GCurrent InnoDB buffer pool free = 46 %Current innodb_buffer_pool_size = 4.00 GDepending on how much space your innodb indexes take up it may be safeto increase this value to up to 2 / 3 of total system memoryMEMORY USAGEMax Memory Ever Allocated : 4.10 GConfigured Max Per-thread Buffers : 2.31 GConfigured Max Global Buffers : 4.09 GConfigured Max Memory Limit : 6.41 GPhysical Memory : 7.62 GMax memory limit seem to be within acceptable normsKEY BUFFERCurrent MyISAM index space = 109 KCurrent key_buffer_size = 64 MKey cache miss rate is 1 : 5Key buffer free ratio = 81 %Your key_buffer_size seems to be fineQUERY CACHEQuery cache is enabledCurrent query_cache_size = 2 MCurrent query_cache_used = 16 KCurrent query_cache_limit = 1 MCurrent Query cache Memory fill ratio = .82 %Current query_cache_min_res_unit = 4 KYour query_cache_size seems to be too high.Perhaps you can use these resources elsewhereMySQL won't cache query results that are larger than query_cache_limit in sizeSORT OPERATIONSCurrent sort_buffer_size = 256 KCurrent read_rnd_buffer_size = 256 KSort buffer seems to be fineJOINSCurrent join_buffer_size = 132.00 KYou have had 0 queries where a join could not use an index properlyYour joins seem to be using indexes properlyOPEN FILES LIMITCurrent open_files_limit = 65535 filesThe open_files_limit should typically be set to at least 2x-3xthat of table_cache if you have heavy MyISAM usage.Your open_files_limit value seems to be fineTABLE CACHECurrent table_open_cache = 4096 tablesCurrent table_definition_cache = 4096 tablesYou have a total of 183 tablesYou have 184 open tables.The table_cache value seems to be fineTEMP TABLESCurrent max_heap_table_size = 16 MCurrent tmp_table_size = 16 MOf 3294 temp tables, 38% were created on diskPerhaps you should increase your tmp_table_size and/or max_heap_table_sizeto reduce the number of disk-based temporary tablesNote! BLOB and TEXT columns are not allow in memory tables.If you are using these columns raising these values might not impact your ratio of on disk temp tables.TABLE SCANSCurrent read_buffer_size = 512 KCurrent table scan ratio = 9703 : 1You have a high ratio of sequential access requests to SELECTsYou may benefit from raising read_buffer_size and/or improving your use of indexes.TABLE LOCKINGCurrent Lock Wait ratio = 0 : 13543Your table locking seems to be fine