mysql参数优化辅助工具之mysqltuner

Mysqltuner.sql 的使用和安装。

Mysqltuner 是一个mysql参数优化辅助工具,它可以对mysql进行全面的体检,然后给出针对性的体检报告

1.mysqltuner 下载

mysqltuner 官网:http://mysqltuner.com/ 可以下载最新版本的。

2.mysqltuner 的安装和使用。

Mysqltuner  就是一套perl脚本,不需要任何的安装,将下载下来的tar安装包解压下就行了。

[[email protected] software]# tar -zxvf major-MySQLTuner-perl-v1.4.0-4-gfa47d9c.tar.gz

[[email protected] software]# cd major-MySQLTuner-perl-fa47d9c

[[email protected]]# ./mysqltuner.pl --user root  --pass [email protected]

>>  MySQLTuner 1.4.0 - Major Hayden<[email protected]>

>>  Bug reports, feature requests, and downloadsat http://mysqltuner.com/

>>  Run with ‘--help‘ for additional options andoutput filtering

[OK] Logged in using credentials passed on the command line

[OK] Currently running supported MySQL version 5.5.17-log

[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------

[--] Status: +CSV +InnoDB +MRG_MYISAM

[--] Data in InnoDB tables: 32G (Tables: 15)

[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)

[!!] Total fragmented tables: 1

-------- Security Recommendations -------------------------------------------

[OK] All database users have passwords assigned

-------- Performance Metrics-------------------------------------------------

[--] Up for: 11d 22h 38m 29s (11M q [11.157 qps], 5K conn, TX: 95B,RX: 29B)

[--] Reads / Writes: 45% / 55%

[--] Total buffers: 4.3G global + 2.1M per thread (2000 max threads)

[!!] Maximum possible memory usage: 8.5G (110% of installed RAM)

[OK] Slow queries: 0% (41K/11M)

[!!] Highest connection usage: 99% (1996/2000)

[OK] Key buffer size / total MyISAM indexes: 256.0M/96.0K

[OK] Key buffer hit rate: 100.0% (1M cached / 8 reads)

[!!] Query cache is disabled

[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 649 sorts)

[OK] Temporary tables created on disk: 0% (134 on disk / 133K total)

[!!] Thread cache hit rate: 24% (4K created / 5K connections)

[!!] Table cache hit rate: 0% (59 open / 7K opened)

[OK] Open file limit used: 0% (57/65K)

[OK] Table locks acquired immediately: 97% (22M immediate / 22Mlocks)

[!!] InnoDB  buffer pool /data size: 4.0G/32.0G

[OK] InnoDB log waits: 0

-------- Recommendations-----------------------------------------------------

General recommendations:

Run OPTIMIZE TABLE todefragment tables for better performance

Reduce your overall MySQLmemory footprint for system stability

Reduce or eliminatepersistent connections to reduce connection usage

Increase table_open_cachegradually to avoid file descriptor limits

Read this beforeincreasing table_open_cache over 64: http://bit.ly/1mi7c4C

Variables to adjust:

*** MySQL‘s maximum memoryusage is dangerously high ***

*** Add RAM beforeincreasing MySQL buffer variables ***

max_connections (>2000)

wait_timeout (< 200)

interactive_timeout (<200)

query_cache_size (>=8M)

thread_cache_size (>64)

table_open_cache (>4220)

innodb_buffer_pool_size (>= 32G)

从mysqltuner的输出可以看出mysqltuner的输出主要包含以下几大块

Storage Engine Statistics:存储引擎的相关统计

Security Recommendations:安装检查

Performance Metrics:性能指标

General recommendations: 物理规划建议

Variables to adjust:变量调整建议

时间: 2024-10-05 05:11:54

mysql参数优化辅助工具之mysqltuner的相关文章

mysql参数优化辅助工具之tuning-primer.sh

Tuning-primer.sh  检测mysql当前的运行情况,产生报告,并给出优化建议. 下载及使用:1.wget http://www.day32.com/MySQL/tuning-primer.sh 2.将tuning-primer.sh拷贝到my.cnf同级目录3.chmod  +x tuning-primer.sh 执行:sh tuning-primer.sh [[email protected] software]#./tuning-primer.sh all Using logi

mysql 性能优化常用工具

mysql 性能优化常用工具: 常用性能检测工具 show engine innodb  status show full processlist information_schema.processlist explain create table innodb_table_monitor(a int) engine=innodb; innodb_locks innodb_lock_wait innodb_trx zabbix监控 pt-tools 工具 性能优化的两种方式: 1.执行计划的解

MySQL参数优化测试建议

一.参数优化前压力测试0.优化测试前提虚拟机vm12.5,OS centos 6.9(系统已优化),cpu2(I5 4288u 2.6GHZ),MEM4GB ,HardDisk:Apple SSD(SM-0512F) 1.模拟数据库数据为了测试我们创建一个test1的库创建一个tb1的表,然后导入20万行数据,脚本如下:vim slap.sh #!/bin/bash HOSTNAME="localhost" PORT="3306" USERNAME="ro

MySQL参数优化

目前针对MySQL数据库进行了一些参数优化,具体如下: my.ini / my.cnf 参数说明 #使用查询缓存 query_cache_size=100M                     #设置MySQL查询缓存的大小,如果MySQL收到同样的查询语句且数据未发生变化,则直接返回缓存中的数据 query_cache_type=1                        #1:开启缓存,0:关闭 innodb_buffer_pool_size=128M              #

【MySQL参数优化】根据架构优化

根据MySQL的架构优化 参数调整的最终效果: 1)SQL执行速度足够快 2)业务吞吐量足够高:TPS,QPS 3)系统负载可控,合理:cpu,io负载 在调整参数的时候,应该熟悉mysql的体系架构,可以根据体系架构分快进行参数调整. 主要方面:内存,线程,磁盘文件,各级缓存 内存 一.通过配置缓冲池的各个方面来提高性能 buffer_pool配置 innodb_buffer_pool_size 默认值:128M  ,一般调整为物理内存的50%-80% 含义:innodb缓存池大小 innod

mysql之 CentOS系统针对mysql参数优化

内核相关参数(/etc/sysctl.conf)  以下参数可以直接放到sysctl.conf文件的末尾: net.core.somaxconn = 65535 net.core.netdev_max_backlog = 65535 net.ipv4.tcp_max_syn_backlog = 65535 加快TCP连接的回收: net.ipv4.tcp_fin_timeout = 10 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1

免费的SqlServer优化辅助工具:SqlOptimize (原创)

主要用于收集客户服务器的数据库运行情况,导出-导入到本地分析. 本工具不会修改你的数据和结构,只会读取相关数据. 1)工具软件下载 http://files.cnblogs.com/files/dude/SqlOptimize.zip 2)SqlOptimize.exe.config 配置要采集的数据库 <?xml version="1.0" encoding="utf-8"?> <configuration> <startup>

mysql参数优化案例

MySQL配置文件my.cnf参数优化和中文详解

Mysql参数优化对于新手来讲,是比较难懂的东西,其实这个参数优化,是个很复杂的东西,对于不同的网站,及其在线量,访问量,帖子数量,网络情况,以及机器硬件配置都有关系,优化不可能一次性完成,需要不断的观察以及调试,才有可能得到最佳效果. [client]port = 3306socket = /tmp/mysql.sock [mysqld]port = 3306socket = /tmp/mysql.sock basedir = /usr/local/mysqldatadir = /data/m