Yahoo 開源的 MySQL 效能分析工具(MySQL Performance Analyzer),

來源:互聯網
上載者:User

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許可之下。查看許可檔案查看詳情。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.