Percona-toolkit Study Notes (vii)

Source: Internet
Author: User
Tags percona

Pt-fifo-split

Function:

Simulate cutting files and pass them through to the first in, first out queue without actually cutting files

Description

Pt-fifo-splitread data from large files and print toFIFOeach time you reach the specified number of lines, go toFIFOfile, print aEOFcharacter, after reading is finished, close offFIFOfile and remove it and then rebuildFIFOfile, and print more lines. This will ensure that you can read the number of lines you read until the read is complete. Note This tool can only work in classUnixoperating system. This program is very useful for importing large files into a database, for specific reference:https://www.percona.com/blog/2008/07/03/how-to-load-large-files-safely-into-innodb-with-load-data-infile/

Instance:

read the records at one time .

Pt-fifo-split--lines 100/root/all.sql

while[-e/tmp/pt-fifo-split]; Do cat/tmp/pt-fifo-split; Done

Pt-find

Features: find MySQL tables and executeactions, like GNU find

Description

Pt-findsearches for MySQL tables and executes actions, like GNU find. The default action is to print the Databaseand table name.

Instance:

pt-find--ctime-1--engine myisam-uroot-proot-h localhost # list creation time less than 1 Days and use MyISAM Data Sheet for the engine

pt-find--engine innodb-uroot-proot-h localhost # List InnoDB Engine's Table

pt-find--ctime-1-uroot-proot-h localhost--exec-plus "drop table%s" # will find the eligible Table Delete

pt-find--tablesize +500m-uroot-proot-h localhost # list total size over 500M the table

Pt-find Hellodb-uroot-proot-hlocalhost # List Hellodb all tables in the library

pt-find--printf "%t\t%d.%n\n"-uroot-proot-hlocalhost | Sort-rn # lists all of the tables Total data and index size , and sort from large to small


Pt-fingerprint

Features: Convert queries into fingerprints.

       used to generate the query thumbprint. MainlySQLQuery GenerationQueryid,pt-query-digestin theIDthat is done through this tool.
       similar toOraclein thesql_id, involving binding variables, literals, etc.

Description

Pt-findsearches for MySQL tables and executes actions, like GNU find. The default action is to print the Databaseand table name.

Instance:

#pt-fingerprint--query "Select A,b,c from Hellodb.students wherestuid=22"

Pt-ioprofile

Features: Pt-ioprofile the principle is to a certain PID Attach a Strace process to IO Analysis

Pt-ioprofileuses "Strace" and "lsof" to watch a process ' s IO and printout a table of files and I/O activity. By default, it watches the mysqld process for the seconds.

Pt-kill

Features: Kill match specified conditions MySQL Statement

Official Example:

Kill queries Runninglonger than 60s:

# Pt-kill--busy-time--kill

Print, do not kill,queries running longer than 60s:

# Pt-kill--busy-time--print

Check for sleepingprocesses and kill them all every 10s:

# Pt-kill--match-command sleep--kill--victims all--interval 10

Print All loginprocesses:

# Pt-kill--match-state login--print--victims All

See which queries inthe Processlist right now would match:

# mysql-e "Showprocesslist" > Proclist.txt

# Pt-kill--test-matchingproclist.txt--busy-time--print

Pt-stalk

Features: used to collect MySQL information related to database failure is convenient for subsequent diagnostic processing. Collect Forensic data about mysqlwhen problems occur

Pt-stalk waits for a trigger condition to be triggered and then collects data to help with the error diagnosis, which is designed to be used Root permission to run the daemon, so you can diagnose intermittent problems that you cannot directly observe. The default diagnostic trigger condition is SHOW GLOBAL STATUS. You can also specify processlist as the diagnostic trigger condition, specified with the --function parameter.

Example 1 : Specifies that the diagnostic trigger condition is Status , while running statements that exceed - , the collected data is stored in the /tmp/test Directory:

# Pt-stalk--function status \

--variable Threads_running--threshold 20 \

--dest/tmp/test---uroot-proot-h192.168.2.11

example 2 : Specifies that the diagnostic trigger condition is processlist 20 statistics trigger, the collected data is stored in /tmp/test

# Pt-stalk--function processlist \

--variable State--matchstatistics--threshold 20 \

--dest/tmp/test---uroot-proot-h192.168.2.11


Percona-toolkit Study Notes (vii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.