Yahoo 开源的 MySQL 性能分析工具(MySQL Performance Analyzer)

原文地址:https://github.com/yahoo/mysql_perf_analyzer

    MySQL Performance Analyzer is an open source project for MySQL performance monitoring and analysis. This repository includes two sub projects: Java web application project myperf Java web server jetty wrapper

MySQL性能分析器是一个MySQL性能监控和分析的开源项目。它包括两个子项目:Java web应用项目myperf和Java web服务器jetty wrapper。

MySQL Performance Analyzer is a Java Maven project. JDK and Maven 3.0 or later are required to build it.

MySQL性能分析器是一个Java Maven项目。JDK和Maven3.0是构建时必须的。

Although JDK 8 is specified in pom.xml, this project does not use Java 8 specific features, so the user can modify pom.xml files of the two sub projects to use different JDK version. For example, if the build host only has JDK 7, modify the file myperf/pom.xml, change the lines

尽管JDK8在pom.xml中已包含,这个项目用不到Java8的特性,所以用户可以自行修改这两个子项目的pom.xml文件来应用不同的JDK版本。比如,构建主机如果只有JDK7,修改myperf/pom.xml文件,将以下内容:

    <source>1.8</source>
    <target>1.8</target>

to 更改为

    <source>1.7</source>
    <target>1.7</target>

The build will create a zip file named as myperfserver-server.zip under directory perfJettyServer/target. To build it, at top level, run

构建时会在perfJettyServer/target目录下生成一个zip文件:myperfserver-server.zip。准备构建,在最顶层,运行命令:

  mvn clean package

Installation and Usage Instructions

        安装和使用说明

  1. Requirement: Java JDK 8, or the one specified by in pom.xml if changed during build time.
        需要的软件:Java JDK8,或者在pom.xml文件中修改的版本。

  2. Unzip myperfserver-server.zip to the desired installation directory. If you intend to install on Windows host, please review two shell scripts and create Windows equivalent.
    解压缩文件myperfserver-server.zip到安装目录。如果在Windows中安装,请先预览两个shell脚本并在环境变量中相应添加。

  3. For a more formal installation, it is recommended to have a MySQL database server to store the metrics. Otherwise, use the built-in derby db. a. Create a database, for example, named as metrics, with the MySQL database server. b. Create a MySQL user (for example, 'metrics'@'my_host' -> here my_host is the machine where you MySQL perf analyzer) with all privileges on above schema. c. The above information will be required when you first login to the analyzer to setup metrics gathering.
    对于一般安装,需要安装MySQL数据库用于存储。否则,可以使用内置的derby数据库。a.在数据库服务器中创建数据库,比如命名为metrics。b.创建一个MySQL用户(比如, 'metrics'@'my_host'->这里的my_host是你将要进行分析的主机)具有全部权限。c.上面的信息在首次登陆到分析器进行设置时需要用到。

  4. Review script start_myperf.sh to see if you need to modify any command line settings. Usually, port number is the only one you need change -j: jettyHome, leave it as it is -p: http port to be used, 9092 by default -w: war (web archive) file, has to be myperf.war -k: working directory, if not specified, it will use ./work -c: url context, default to /myperf, leave it as is.
    查看start_myperf.sh脚本看是否你需要修改命令行中的设置。通常,端口号是你唯一需要修改的地方,参数 -j: jettyHome,不用修改;参数 -p: http 端口, 默认为9092;参数-w:war(web压缩),必须是myperf.war; 参数-k:工作目录,如果没有修改,将使用./work; 参数-c:url内容, 默认跳转到/myperf目录,保留不变即可。

    Modify java command path inside start_myperf.sh, if needed.
        如果需要,在文件start_myperf.sh中修改java命令的path目录

  5. Start up: ./start_myperf.sh Check nohup.out and logs directory for any error logs.
        开始命令:./start_myperf.sh,注意检查nohup.out文件和日志目录的错误日志

  6. Shutdown: ./stop_myperf.sh
       关闭命令:./stop_myperf.sh

  7. First time Login and Setup After startup, point your browser to http://your_host:9092/myperf (or the port number you changed). The initial login user and credential are myperf/change.
    在第一次安装启动后登陆时,用浏览器打开http://your_host:9092/myperf (或者你设定的其他端口)。初始用户名和密码是myperf/change。

After login, you will be directed to setup page:
   
登陆后,你会被重定向到安装设置页面:

You can add an email address for notifications. The email uses OS "mailx" command.
   
你可以添加提醒的email地址。邮件使用"mailx"系统命令。

Configure the metrics storage database, using the one that you created in the earlier steps. A metrics scan interval of 1 or 5 minutes should be good enough.
     
配置存储数据库,使用之前步骤创建的那个数据库。一个扫描周期设置为1到5分钟正好合适。

If use built-in derbydb, choose short retention days.
   
如果使用内置derbydb数据库,保留日期要缩短。

After configuration is done, you need to start the scanner ("Start Scanner" button on top of the page).
 
  配置完毕后,你可以开始扫描(“Start Scanner”按钮在页面顶部)。

Everytime you change the configuration, you need to restart the scanner.
   
每次改变配置后,你需要重启扫描器。

If the scanner does not work as expected, restart the analyzer ./stop_myperf.sh then ./start_myperf.sh
   如果扫描器未正常工作,重启分析器,使用命令:./stop_myperf.sh then ./start_myperf.sh

  1. For each database server you want to monitor, you need to create a MySQL user with the following privileges: a. process b. replication client c. show databases d. show view e. select on all (if you want to use it to check data dictionary or run explain plans)
    对于每一个你要监控的数据库服务器,你需要创建具有以下权限的用户:a.process b.复制客户端 c.显示数据库 d.显示视图 e.选择全部(如果你想用它检查数据目录或者运行说明计划)

  2. The analyzer relies on Linux SNMP to gather OS level data. Check snmpd service status.
        分析器需要依赖于Linux SNMP服务来搜集系统级别的数据。检查snmpd服务是否可用。

Known Limitations
   
已知到限制

  1. snmpd is based on the Linux specification.
    snmpd是基于linux规范。
  2. Email notification uses Linux's "mailx" command.
    电子邮件提醒使用Linux的“mailx”命令。

License
 
 许可

This code licensed under the Apache license. See the LICENSE file for terms.
   
代码的许可在Apache许可之下。查看许可文件查看详情。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值