Percona tool kit for MySQL DBA's

2,050 views
1,791 views

Published on

This was my second presentation taken on MySQL User Camp ( Bangalore ) held on Nov-08 2013. I have a made a presentation about the percona tools mostly used percona tools.

Published in: Technology, Sports
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,050
On SlideShare
0
From Embeds
0
Number of Embeds
111
Actions
Shares
0
Downloads
30
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Percona tool kit for MySQL DBA's

  1. 1. Percona Tool kits For DBA’s 1
  2. 2. About me • • • • • P.R.Karthik 3 Years plus experience in MySQL as a DBA. Worked for various e-commerce companies in INDIA. Currently in one of biggest MySQL server farms. remotemysqldba.blogspot.in 2
  3. 3. Percona Tool kit • • • • • • • • Maintained by Percona Team. Originated from Aspersa and Maakit. Initially Designed by Baron Schwartz. Designed for MySQL and its forks. Works on all Linux Platforms. Matured and proven tool. Set of 33 cmd line tools. Latest version 2.2.5 ( 16-10-2013) 3
  4. 4. Percona Tool kit • • • • • Pt-query-digest Pt-table-checksum Pt-table-sync Pt-online-schema-change Pt-kill 4
  5. 5. Pt-query-digest 5
  6. 6. Pt-query-digest • Analyses the Queries. • Slow query log, Query logs. • Works on tcpdump too. Other tools for Query logs 1) Mysqldumpslow 2) mysqlsla 6
  7. 7. Pt-query-digest 7
  8. 8. Pt-query-digest 8
  9. 9. Pt-query-digest • It collects the queries and rank them based on the usage stats. • The queries collected can be analyzed easily. Query Analyzers: Pt-Visual-explain and Visual Explain ( MySQL 5.6 Workbench ) 9
  10. 10. Pt-table-checksum 10
  11. 11. Pt-table-checksum It helps in checking the replication integrity of mysql. Need to check: • Direct writes on slave. • Skipping the events. • Many others. 11
  12. 12. Pt-table-checksum 12
  13. 13. Pt-table-checksum How it works : 1) 2) 3) 4) Check for replication lag Takes data in small chunks. Make checksum on chunk with replace into select. Displays the output. Note: It has more safety options. 13
  14. 14. Pt-table-sync 14
  15. 15. Pt-table-sync Synchronizes the data between the master and slave servers. It is a very effective tool and it can be used along with pt-table-checksum to make the data sync. 15
  16. 16. Pt-table-sync • pt-table-sync --execute h=10.0.0.25,u=pttool,p=tool --sync-to-master --print --databases world 16
  17. 17. Pt-table-sync How it works : 1) Check for replication lag and delay. 2) Takes data in small chunks. 3) Make the data check based on Pk or Unique index most cases. 4) Then synchronizes the data. Note: It is a read/write tool, precautions must be taken. 17
  18. 18. Pt-Online-Schema-Change 18
  19. 19. Pt-OSC Helps in modifying the table structure without much locking. Need to alter: • • • • Adding an index for performance. Modifying a column. Adding a column. Altering the engine 19
  20. 20. Pt-OSC How it works : 1) 2) 3) 4) 5) Create a new table with modified structure. Creates triggers for data changes. Copies data in small chunks. Swaps the table. Drop the old table and triggers. 20
  21. 21. Pt-OSC Adding a column: pt-online-schema-change --execute --user=pttool --pass=tool --alter "add column region char(30)" D=world,t=page_city Adding a Index: pt-online-schema-change --execute --user=pttool --pass=tool --alter "add index idx_dist (District)" D=world,t=page_city Altering Engine : pt-online-schema-change --execute --user=pttool –pass=tool --alter "engine=innodb" D=world,t=hio_city 21
  22. 22. Pt-Kill 22
  23. 23. Pt-kill It helps to kill queries based on the filter input. Repetitive and mass killing Need to Kill: • Application not closing the connection properly • Ill framed resource consuming queries • Too many bad queries running in parallel. 23
  24. 24. Pt-kill For sleep queries: pt-kill --user kill --ask-pass --socket=/tmp/mysql.sock --database test --matchcommand Sleep --kill --print --victims all --interval 15 For user specific: pt-kill --user kill --ask-pass --socket=/tmp/mysql.sock --print --match-user benchmark --kill --victims all For pattern match: pt-kill --user kill --ask-pass --socket=/tmp/mysql.sock --kill-query --victims all --database test --match-info 'SELECT DISTINCT c from sbtest' 24
  25. 25. THANKS FOR PARTICIPATION remotemysqldba.blogspot.in 25

×