Mysql 複製工具(percona-toolkit)

來源:互聯網
上載者:User

標籤:

Mysql 複製工具

1.percona-toolkit簡介

percona-toolkit是一組進階命令列工具的集合,用來執行各種通過手工執行非常複雜和麻煩的mysql和系統任務,這些任務包括:

  • 檢查master和slave資料的一致性
  • 有效地對記錄進行歸檔
  • 尋找重複的索引
  • 對伺服器資訊進行匯總
  • 分析來自日誌和tcpdump的查詢
  • 當系統出問題的時候收集重要的系統資訊

percona-toolkit源自Maatkit 和Aspersa工具,這兩個工具是管理mysql的最有名的工具,現在Maatkit工具已經不維護了,請大家還是使用percona-toolkit吧!這些工具主要包括開發、效能、配置、監控、複製、系統、實用六大類,作為一個優秀的DBA,裡面有的工具非常有用,如果能掌握並加以靈活應用,將能極大的提高工作效率。

?

2.安裝percona-toolkit

[[email protected] ~]# yum -y install percona-toolkit-2.2.4-1.noarch.rpm

?

[[email protected] ~]# pt #以pt開頭命令

?

3.簡單使用

(1).伺服器摘要

[[email protected] ~]# pt-summary

(2).伺服器磁碟監測

[[email protected] ~]# pt-diskstats

(3).mysql服務狀態摘要

[[email protected] ~]# pt-mysql-summary -- --user=root

?

(4).慢查詢日誌分析統計

?

?

[[email protected] ~]# pt-query-digest /mydata/data/mysql-slow.log

?

(5).主從狀態監測,提供給它一台mysql伺服器的IP使用者名稱密碼,就可以分析出整個主從架構中每台伺服器的資訊,包括但不限於mysql版本,IP地址,server ID,mysql服務的啟動時間,角色(主/從),Slave Status(落後於主伺服器多少秒,有沒有錯誤,slave有沒有在運行)。

?

[[email protected] ~]# pt-slave-find --host=localhost --user=root

(6).mysql死結監測

[[email protected] ~]# pt-duplicate-key-checker --database=xxx h=‘127.0.0.1‘ --user=root --password=xxxx

查看某個xxx資料庫,密碼是自己授權時設定的,也可以沒有密碼

?

(7).監測從庫的複寫延遲

?

[[email protected] ~]# pt-slave-delay --host xxx --user=root --password=xxx

?

?

?

?

?

?

?

?

Mysql 複製工具(percona-toolkit)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.