Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1441482
  • 博文数量: 77
  • 博客积分: 2104
  • 博客等级: 大尉
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 13:21
个人简介

关注于系统高可用、网站架构

文章分类

全部博文(77)

文章存档

2018年(1)

2017年(1)

2015年(4)

2014年(8)

2013年(4)

2012年(12)

2011年(17)

2010年(30)

分类: Mysql/postgreSQL

2014-06-30 14:36:55

使用该脚本可以很方便了解目前mysql参数设置是否合理
下载脚本
wget
添加执行权限
chmod 755 tuning-primer.sh 
运行
root@db1:~$ ./tuning-primer.sh 

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] n
Do you have your login handy ? [y/N] : y
User: root
Password: 2xfghuh
 
Would you like me to create a ~/.my.cnf file for you? [y/N] : n
 
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -


MySQL Version 5.1.56-log x86_64


Uptime = 6 days 5 hrs 53 min 29 sec
Avg. qps = 40420
Total Questions = 21811220771
Threads Connected = 296


Server has been running for over 48hrs.
It should be safe to follow 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
for info about MySQL's Enterprise Monitoring and Advisory Service

 SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 10.000000 sec.
You have 319 out of 21811222992 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

 WORKER THREADS
Current thread_cache_size = 64
Current threads_cached = 17
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

 MAX CONNECTIONS
Current max_connections = 3000
Current threads_connected = 296
Historic max_used_connections = 392
The number of used connections is 13% of the configured maximum.
Your max_connections variable seems to be fine.

 INNODB STATUS
Current InnoDB index space = 8.57 G
Current InnoDB data space = 14.42 G
Current InnoDB buffer pool free = 56 %
Current innodb_buffer_pool_size = 20.00 G
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

 MEMORY USAGE
Max Memory Ever Allocated : 38.60 G
Configured Max Per-thread Buffers : 139.81 G
Configured Max Global Buffers : 20.33 G
Configured Max Memory Limit : 160.14 G
Physical Memory : 47.15 G

 Max memory limit exceeds 90% of physical memory

 KEY BUFFER
Current MyISAM index space = 555 K
Current key_buffer_size = 245 M
Key cache miss rate is 1 : 14478
Key buffer free ratio = 81 %
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 = 17 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = .02 %
Current query_cache_min_res_unit = 4 K
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 = 15 M
Current read_rnd_buffer_size = 16 M
Sort buffer seems to be fine

 JOINS
Current join_buffer_size = 7.81 M
You have had 801 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 = 28196 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 = 1024 tables
Current table_definition_cache = 256 tables
You have a total of 415 tables
You have 1024 open tables.
Current table_cache hit rate is 86%
, while 100% of your table cache is in use
You should probably increase your table_cache
You should probably increase your table_definition_cache value.

 TEMP TABLES
Current max_heap_table_size = 512 M
Current tmp_table_size = 1.00 G
Of 2355076 temp tables, 2% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

 TABLE SCANS
Current read_buffer_size = 8 M
Current table scan ratio = 11 : 1
read_buffer_size seems to be fine

 TABLE LOCKING
Current Lock Wait ratio = 1 : 144004850
Your table locking seems to be fine
阅读(5994) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~