mysql性能调优工具之tuning-primer.sh

测试环境

centos7.5+mysql5.7.29

安装

该脚本添加执行权限后,将219、220行注释,221、222取消注释即可
219 #mysql=“mysql”
220 #mysqladmin=“mysqladmin”
221 mysql=“mysql -S $socket”
222 mysqladmin=“mysqladmin -S $socket”

查看数据库信息

tuning-primer通过以下几种模式来查看数据库信息
在这里插入图片描述
查看所有内容
[root@lineqi opt]# ./tuning-primer.sh all

    -- MYSQL PERFORMANCE TUNING PRIMER --
         - By: Matthew Montgomery -

MySQL Version 5.7.29-log x86_64

Uptime = 0 days 0 hrs 8 min 8 sec
Avg. qps = 0
Total Questions = 44
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:
UNSUPPORTED MYSQL VERSION
测试是环境是刚启动的虚拟机,所以这里没有获取到相应的统计信息
查看磁盘内容
[root@lineqi opt]# ./tuning-primer.sh disk

OPEN FILES LIMIT
Current open_files_limit = 5000 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 = 400 tables
Current table_definition_cache = 400 tables
You have a total of 126 tables
You have 41 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 64 M
Current tmp_table_size = 32 M
Of 83 temp tables, 10% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 418 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 72
Your table locking seems to be fine
查看内存情况
[root@lineqi opt]# ./tuning-primer.sh mem

MEMORY USAGE
Max Memory Ever Allocated : 2.01 G
Configured Max Per-thread Buffers : 2.68 G
Configured Max Global Buffers : 2.01 G
Configured Max Memory Limit : 4.70 G
Physical Memory : 1.77 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 43 K
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 2
Key buffer free ratio = 81 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 1 M
Current query_cache_used = 16 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 1.59 %
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 = 1 M
Current read_rnd_buffer_size = 256 K
No sort operations have been performed
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值