Chinaunix首页 | 论坛 | 博客

OPS

  • 博客访问: 490187
  • 博文数量: 117
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1210
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-05 14:50
个人简介

hellow 运维

文章分类

全部博文(117)

文章存档

2019年(1)

2018年(1)

2017年(45)

2016年(38)

2015年(32)

我的朋友

分类: 系统运维

2016-12-24 13:52:10

MySQLTuner 是一个 Perl 脚本,可以用来分析您的 MySQL 性能,并且基于收集到的信息给出相应的优化建议。这样子,您就可以调整 my.cnf 从而优化您的 MySQL 设置。

这边只是介绍使用方法,不保证说 MySQLTuner 对您就是绝对有效。

首先需要下载 MySQLTuner

# wget 

设置权限为可执行

# chmod +x mysqltuner.pl

然后就可以直接运行了

# ./mysqltuner.pl

如果遇到错误 Unable to find mysqladmin in your $PATH 可以输入

# PATH=$PATH:/usr/local/mysql/bin

PS:把 /usr/local/mysql/bin 改为您 MySQL 程序 mysqladmin 的路径

运行后的内容如下:
./mysqltuner.pl --user root --pass nongyao001 --socket /tmp/mysq.sock 

General recommendations:
    Control warning line(s) into /www/wdlinux/mysql-5.5.48/data/cent98.dt50.cn.err file
    Control error line(s) into /www/wdlinux/mysql-5.5.48/data/cent98.dt50.cn.err file
    Run OPTIMIZE TABLE to defragment tables for better performance
      OPTIMIZE TABLE west.destoon_article_data_21; -- can free 158.651298522949 MB
    Total freed space after theses OPTIMIZE TABLE : 158.651298522949 Mb
    Restrict Host for user@% to user@SpecificDNSorIp
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_type (=0)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    innodb_buffer_pool_instances(=4)

浏览输出的结果,特别是末尾的 Recommendations ,里面一般会提到您需要在 my.cnf 修改的内容。修改 my.cnf 后记得重启 MySQL 。重启后再运行 MySQLTuner 检查。另外需要注意的是 MySQL 需要启动 24 小时候再运行 MySQLTuner ,不然有些内容会不准。

阅读(980) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~