• mysql性能监控工具:mycheckpoint的使用方法


    mycheckpoint 是针对mysql的一个性能监控、指标采集的python写成的工具。

    工作原理说明:

    mycheckpoint是一段脚本,通过将其设置为crontab定时任务,每几分钟采集一次数据(受限于crontab只能是分钟为基本单位)存储在自己的数据库中,并可以将采集的数据进行统计,以web页面的形式展现出来。

    示例效果:

    mycheckpoint-dml-chart-sample-88

    详细请参见:http://code.openark.org/forge/mycheckpoint

    使用步骤:

    0. 下载:

     wget https://mycheckpoint.googlecode.com/files/mycheckpoint-231.tar.gz


    1. 为mycheckpoint创建数据库 

    CREATE DATABASE mycheckpoint;

    2. 授权给当前登录mysql的用户

     GRANT ALL PRIVILEGES ON mycheckpoint.* TO 'root'@'localhost' IDENTIFIED BY 'xxxx';

    3. 创建mycheckpoint需要的数据库表。

        mycheckpoint --host=127.0.0.1 --port=3306 --user=root --password=xxxx --socket=/mysql/tmp/mysql.sock --database=mycheckpoint

    进过这一个步骤之后,会在名为:mycheckpoint数据库中,生成以下数据表。

    +------------------------------------+
    | Tables_in_mycheckpoint             |
    +------------------------------------+
    | alert                              |
    | alert_condition                    |
    | alert_condition_query_view         |
    | alert_email_message_items_view     |
    | alert_pending                      |
    | alert_pending_html_view            |
    | alert_pending_view                 |
    | alert_view                         |
    | charts_api                         |
    | custom_query                       |
    | custom_query_top_navigation_view   |
    | custom_query_view                  |
    | html_components                    |
    | metadata                           |
    | numbers                            |
    | status_variables                   |
    | status_variables_aggregated_day    |
    | status_variables_aggregated_hour   |
    | sv_custom_chart_day                |
    | sv_custom_chart_flattened_day      |
    | sv_custom_chart_flattened_hour     |
    | sv_custom_chart_flattened_sample   |
    | sv_custom_chart_hour               |
    | sv_custom_chart_sample             |
    | sv_custom_html                     |
    | sv_custom_html_brief               |
    | sv_day                             |
    | sv_diff                            |
    | sv_hour                            |
    | sv_latest                          |
    | sv_param_change                    |
    | sv_parameter_change_union          |
    | sv_report_24_7                     |
    | sv_report_24_7_minmax              |
    | sv_report_chart_24_7               |
    | sv_report_chart_day                |
    | sv_report_chart_day_labels         |
    | sv_report_chart_day_timeseries     |
    | sv_report_chart_hour               |
    | sv_report_chart_hour_labels        |
    | sv_report_chart_hour_timeseries    |
    | sv_report_chart_sample             |
    | sv_report_chart_sample_labels      |
    | sv_report_chart_sample_timeseries  |
    | sv_report_day                      |
    | sv_report_day_recent               |
    | sv_report_day_recent_minmax        |
    | sv_report_hour                     |
    | sv_report_hour_recent              |
    | sv_report_hour_recent_minmax       |
    | sv_report_html                     |
    | sv_report_html_24_7                |
    | sv_report_html_brief               |
    | sv_report_human_day                |
    | sv_report_human_hour               |
    | sv_report_human_sample             |
    | sv_report_sample                   |
    | sv_report_sample_recent            |
    | sv_report_sample_recent_aggregated |
    | sv_report_sample_recent_minmax     |
    | sv_sample                          |
    +------------------------------------+

    如果意外将你的web app 的DB指定成了log数据库,则会在你的web app DB中加入以上数据表,并将原web app DB中重名的数据表删除。这将是灾难性的!

    4. 将mycheckpoint配置成定时任务

    * * * * * /usr/local/bin/mycheckpoint  --user=root --password=xxxx --socket=/redmine/mysql/tmp/mysql.sock --database=mycheckpoint

    5. http方式查看结果:

       mycheckpoint --host=127.0.0.1 --port=3306 --user=root --password=xxxx --socket=/mysql/tmp/mysql.sock --database=mycheckpoint  http

    指定数据库时需注意,切莫使用你的web app 的DB. 

    一个小时之后就可以打开本地的http://localhost:12306/mycheckpoint 查看报表。

    点评: 

    这个工具的优势是能将数据统计结果以web形式展现,但是由于其依赖crontab,导致数据采集间隔过大,不能很好的描述mysql的运行状况, 另外,此工具已经于2014年4月停止更新

    其它的mysql第三方工具还有: percona-toolkit / mysqltuner.pl / tuning-primer.sh 等。

     

    参考:

    1. http://code.openark.org/forge/mycheckpoint

    2. https://code.google.com/p/mycheckpoint/downloads/list

  • 相关阅读:
    C#数组学习
    关于servlet中要写初始化逻辑应该重载有参还是无参的init
    servlet初识servletConfig
    servlet通过响应头Content-Disposition实现文件下载效果
    response中setCharacterEncoding和setContentType的区别
    通过refresh响应头,定时刷新或隔n秒跳转页面
    通过location响应头实现重定向
    三层交换原理
    什么是CLOS架构?
    Cat8 八类网线是什么?与Cat5、Cat6、Cat7网线的区别?
  • 原文地址:https://www.cnblogs.com/ToDoToTry/p/4394249.html
Copyright © 2020-2023  润新知