mysqltuner.pl
是mysql一个常用的数据库性能诊断工具,主要检查参数设置的合理性包括日志文件、存储引擎、安全建议及性能分析。针对潜在的问题,给出改进的建议。是mysql优化的好帮手。
下载:
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
使用
[root@localhost ~]# ./mysqltuner.pl --socket /var/lib/mysql/mysql.sock
>> MySQLTuner 1.7.4 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 5.7.23
[OK] Operating on 64-bit architecture
报告分析
1)重要关注 [!!](中括号有叹号的项)例如 [!!] Maximum possible memory usage: 4.8G (244.13% of installed RAM)
,表示内存已经严重用超了。
2)关注最后给的建议“Recommendations ”。
tuning-primer.sh
mysql的另一个优化工具,针于mysql的整体进行一个体检,对潜在的问题,给出优化的建议。
目前,支持检测和优化建议的内容如下:
下载
[root@localhost ~]#wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh
使用
[root@localhost ~]# [root@localhost dba]# ./tuning-primer.sh
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
报告分析
重点查看有红色告警的选项,根据建议结合自己系统的实际情况进行修改,例如:
掌握一个就可以了。
仅此记录,以防遗忘。
FROM: https://mp.weixin.qq.com/s/ppPYwUNATMcudsxrV3yKpA
END