从零开始的Linux运维屌丝之路,资源免费分享平台   运维人员首选:简单、易用、高效、安全、稳定、社区活跃的开源软件

MySQL 参数调优工具 tuning-primer

发布:蔺要红03-05分类: MYSQL


下载地址        https://mirrors.linyaohong.com/conf/mysql/tuning-primer.sh
GitHub项目地址  https://github.com/BMDan/tuning-primer.sh

其他工具  mysqlreport  https://blog.51cto.com/12965094/2163596     https://www.cnblogs.com/shangzekai/p/4672726.html

使用方法:(在配置文件里加入,)
[root@test01 ~]# cat /etc/my.cnf
[client]
user = root
password	= 1111111
port		= 3306
socket		= /tmp/mysql.sock

[root@test01 ~]# ./tuning-primer.sh  # 运行(数据库应当运行一段时间来分析,刚启动分析是不准的)
# 运行效果如下,数据库刚启动,不准,但是可以参考/网站峰值过后运行效果最佳/可以狠直观的看到配置文件哪里不合适
 
 -- MYSQL PERFORMANCE TUNING PRIMER --
      - By: Matthew Montgomery -

MySQL Version 5.5.62-log x86_64

Uptime = 0 days 0 hrs 0 min 5 sec
Avg. qps = 19
Total Questions = 96
Threads Connected = 1

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.5/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 enabled.
Current long_query_time = 3.000000 sec.
You have 0 out of 117 that take longer than 3.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled
Binlog sync is not enabled, you could loose binlog records during a server crash

WORKER THREADS
Current thread_cache_size = 256
Current threads_cached = 1
Current threads_per_sec = 1
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 200
Current threads_connected = 1
Historic max_used_connections = 2
The number of used connections is 1% 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 memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 2.52 G
Current InnoDB data space = 5.05 G
Current InnoDB buffer pool free = 90 %
Current innodb_buffer_pool_size = 4.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 : 5.70 G
Configured Max Per-thread Buffers : 3.66 G
Configured Max Global Buffers : 5.50 G
Configured Max Memory Limit : 9.16 G
Physical Memory : 15.51 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 180 M
Current key_buffer_size = 1.00 G
Key cache miss rate is 1 : 4
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 384 M
Current query_cache_used = 1 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = .34 %
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 = 4 M
Current read_rnd_buffer_size = 2 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 8.00 M
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly
join_buffer_size >= 4 M
This is not advised

OPEN FILES LIMIT
Current open_files_limit = 65535 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 = 400 tables
You have a total of 9466 tables
You have 2048 open tables.
Current table_cache hit rate is 7%
, 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 = 4.00 G
Current tmp_table_size = 4.00 G
Of 745 temp tables, 40% were created on disk
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 = 4 M
Current table scan ratio = 284 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 1072
Your table locking seems to be fine


 
温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,如有侵权我会在24小时之内删除!

欢迎使用手机扫描访问本站