超爽的mysql性能优化工具---“tuner-primer”

超爽的mysql性能优化工具---“tuner-primer”
文章来源:http://hi.baidu.com/%CA%AB%D5%B9/blog/item/47e475f04958c8aaa50f5233.html
mysql下tuner-primer使用说明
mysql tuner-primer是检测mysql的主配置文件my.cnf的有力工具,当然还有其他工具,比如mysqlreport,今天先介绍这个工具的使用。
下载并改变执行权限:
wget
http://www.day32.com/MySQL/tuning-primer.sh
chmod a+x tuning-primer.sh
./tuning-primer.sh
首先会要求输入服务器的用户名和密码,并提示保存在当前用户目录下配置文件。
再次执行脚本就会运行,不用输入用户名和密码,并给出参数配置,强悍就强悍在这!!!!
看看我的相关提示,
[root@slave1 tuning-primer]# ./tuning-primer.sh
- INITIAL LOGIN ATTEMPT FAILED -
Testing Stored for passwords: None Found
- RETRY LOGIN ATTEMPT FAILED -
Could not auto detect login info!
Do you have your login handy ? [y/N] : y
User: root
Password:
Would you like me to create a ~/.my.cnf file for you? [y/N] : y
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -
MySQL Version 5.1.22-rc-log i686
Uptime = 1 days 2 hrs 16 min 29 sec
Avg. qps = 348
Total Questions = 32946460
Threads Connected = 23
Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations
To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
Visit
http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 44 out of 32946564 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine
BINARY UPDATE LOG
The binary update log is enabled
The expire_logs_days is not set.
The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually
Setting expire_log_days will allow you to remove old binary logs automatically
See
http://dev.mysql.com/doc/refman/5.1/en/purge-master-logs.html
WORKER THREADS
Current thread_cache_size = 1024
Current threads_cached = 363
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 1500
Current threads_connected = 22
Historic max_used_connections = 391
The number of used connections is 26% of the configured maximum.
Your max_connections variable seems to be fine.
MEMORY USAGE
Max Memory Ever Allocated : 61 G
Configured Max Per-thread Buffers : 225 G
Configured Max Global Buffers : 2 G
Configured Max Memory Limit : 228 G
Physical Memory : 3.95 G
Max memory limit exceeds 90% of physical memory
KEY BUFFER
Current MyISAM index space = 2 G
Current key_buffer_size = 512 M
Key cache miss rate is 1 : 121
Key buffer fill ratio = 31.00 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere
QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 14 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 23.29 %
Current query_cache_min_res_unit = 4 K
Query Cache is 23 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size
SORT OPERATIONS
Current sort_buffer_size = 4 M
Current read_rnd_buffer_size = 15 M
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 4.00 M
You have had 22509 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
OPEN FILES LIMIT
Current open_files_limit = 8192 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine
TABLE CACHE
Current table_open_cache = 2048 tables
Current table_definition_cache = 128 tables
You have a total of 400 tables
You have 588 open tables.
The table_cache value seems to be fine
You should probably increase your table_definition_cache value.
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 64 M
Of 53670 temp tables, 44% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! 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 SCANS
Current read_buffer_size = 127 M
Current table scan ratio = 407 : 1
read_buffer_size is over 8 MB there is probably no need for such a large read_buffer
TABLE LOCKING
Current Lock Wait ratio = 1 : 3135582
Your table locking seems to be fine
ok,通过终端输入,可以显示出各种不通颜色的提示信息,非常人性化,对照参数提示,可以很简单的调整出最适合你的运行环境的配置文件,好了,不多说了,动手吧!!

你可能感兴趣的:(mysql,数据库,职场,休闲)