.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PERCONA-TOOLKIT 1p" .TH PERCONA-TOOLKIT 1p "2012-06-15" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" percona\-toolkit \- Advanced command\-line tools used by Percona for MySQL support and consulting .SH "DESCRIPTION" .IX Header "DESCRIPTION" Percona Toolkit is a collection of advanced command-line tools used by Percona () support staff to perform a variety of MySQL and system tasks that are too difficult or complex to perform manually. .PP These tools are ideal alternatives to private or \*(L"one-off\*(R" scripts because they are professionally developed, formally tested, and fully documented. They are also fully self-contained, so installation is quick and easy and no libraries are installed. .PP Percona Toolkit is derived from Maatkit and Aspersa, two of the best-known toolkits for MySQL server administration. It is developed and supported by Percona Inc. For more information and other free, open-source software developed by Percona, visit . .SH "TOOLS" .IX Header "TOOLS" This release of Percona Toolkit includes the following tools: .IP "pt-align" 4 .IX Item "pt-align" Align output from other tools to columns. .IP "pt-archiver" 4 .IX Item "pt-archiver" Archive rows from a MySQL table into another table or a file. .IP "pt-config-diff" 4 .IX Item "pt-config-diff" Diff MySQL configuration files and server variables. .IP "pt-deadlock-logger" 4 .IX Item "pt-deadlock-logger" Extract and log MySQL deadlock information. .IP "pt-diskstats" 4 .IX Item "pt-diskstats" An interactive I/O monitoring tool for GNU/Linux. .IP "pt-duplicate-key-checker" 4 .IX Item "pt-duplicate-key-checker" Find duplicate indexes and foreign keys on MySQL tables. .IP "pt-fifo-split" 4 .IX Item "pt-fifo-split" Split files and pipe lines to a fifo without really splitting. .IP "pt-find" 4 .IX Item "pt-find" Find MySQL tables and execute actions, like \s-1GNU\s0 find. .IP "pt-fingerprint" 4 .IX Item "pt-fingerprint" Convert queries into fingerprints. .IP "pt-fk-error-logger" 4 .IX Item "pt-fk-error-logger" Extract and log MySQL foreign key errors. .IP "pt-heartbeat" 4 .IX Item "pt-heartbeat" Monitor MySQL replication delay. .IP "pt-index-usage" 4 .IX Item "pt-index-usage" Read queries from a log and analyze how they use indexes. .IP "pt-ioprofile" 4 .IX Item "pt-ioprofile" Watch process \s-1IO\s0 and print a table of file and I/O activity. .IP "pt-kill" 4 .IX Item "pt-kill" Kill MySQL queries that match certain criteria. .IP "pt-log-player" 4 .IX Item "pt-log-player" Replay MySQL query logs. .IP "pt-mext" 4 .IX Item "pt-mext" Look at many samples of MySQL \f(CW\*(C`SHOW GLOBAL STATUS\*(C'\fR side-by-side. .IP "pt-mysql-summary" 4 .IX Item "pt-mysql-summary" Summarize MySQL information nicely. .IP "pt-online-schema-change" 4 .IX Item "pt-online-schema-change" \&\s-1ALTER\s0 tables without locking them. .IP "pt-pmp" 4 .IX Item "pt-pmp" Aggregate \s-1GDB\s0 stack traces for a selected program. .IP "pt-query-advisor" 4 .IX Item "pt-query-advisor" Analyze queries and advise on possible problems. .IP "pt-query-digest" 4 .IX Item "pt-query-digest" Analyze query execution logs and generate a query report, filter, replay, or transform queries for MySQL, PostgreSQL, memcached, and more. .IP "pt-show-grants" 4 .IX Item "pt-show-grants" Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them. .IP "pt-sift" 4 .IX Item "pt-sift" Browses files created by pt-collect. .IP "pt-slave-delay" 4 .IX Item "pt-slave-delay" Make a MySQL slave server lag behind its master. .IP "pt-slave-find" 4 .IX Item "pt-slave-find" Find and print replication hierarchy tree of MySQL slaves. .IP "pt-slave-restart" 4 .IX Item "pt-slave-restart" Watch and restart MySQL replication after errors. .IP "pt-stalk" 4 .IX Item "pt-stalk" Gather forensic data about MySQL when a problem occurs. .IP "pt-summary" 4 .IX Item "pt-summary" Summarize system information nicely. .IP "pt-table-checksum" 4 .IX Item "pt-table-checksum" Verify MySQL replication integrity. .IP "pt-table-sync" 4 .IX Item "pt-table-sync" Synchronize MySQL table data efficiently. .IP "pt-table-usage" 4 .IX Item "pt-table-usage" Analyze how queries use tables. .IP "pt-tcp-model" 4 .IX Item "pt-tcp-model" Transform tcpdump into metrics that permit performance and scalability modeling. .IP "pt-trend" 4 .IX Item "pt-trend" Compute statistics over a set of time-series data points. .IP "pt-upgrade" 4 .IX Item "pt-upgrade" Execute queries on multiple servers and check for differences. .IP "pt-variable-advisor" 4 .IX Item "pt-variable-advisor" Analyze MySQL variables and advise on possible problems. .IP "pt-visual-explain" 4 .IX Item "pt-visual-explain" Format \s-1EXPLAIN\s0 output as a tree. .PP For more free, open-source software developed Percona, visit . .SH "CONFIGURATION FILES" .IX Header "CONFIGURATION FILES" Percona Toolkit tools can read options from configuration files. The configuration file syntax is simple and direct, and bears some resemblances to the MySQL command-line client tools. The configuration files all follow the same conventions. .PP Internally, what actually happens is that the lines are read from the file and then added as command-line options and arguments to the tool, so just think of the configuration files as a way to write your command lines. .SS "\s-1SYNTAX\s0" .IX Subsection "SYNTAX" The syntax of the configuration files is as follows: .IP "\(bu" 4 Whitespace followed by a hash sign (#) signifies that the rest of the line is a comment. This is deleted. For example: .IP "\(bu" 4 Whitespace is stripped from the beginning and end of all lines. .IP "\(bu" 4 Empty lines are ignored. .IP "\(bu" 4 Each line is permitted to be in either of the following formats: .Sp .Vb 2 \& option \& option=value .Ve .Sp Do not prefix the option with \f(CW\*(C`\-\-\*(C'\fR. Do not quote the values, even if it has spaces; value are literal. Whitespace around the equals sign is deleted during processing. .IP "\(bu" 4 Only long options are recognized. .IP "\(bu" 4 A line containing only two hyphens signals the end of option parsing. Any further lines are interpreted as additional arguments (not options) to the program. .SS "\s-1EXAMPLE\s0" .IX Subsection "EXAMPLE" This config file for pt-stalk, .PP .Vb 5 \& # Config for pt\-stalk \& variable=Threads_connected \& cycles=2 # trigger if problem seen twice in a row \& \-\- \& \-\-user daniel .Ve .PP is equivalent to this command line: .PP .Vb 1 \& pt\-stalk \-\-variable Threads_connected \-\-cycles 2 \-\- \-\-user daniel .Ve .PP Options after \f(CW\*(C`\-\-\*(C'\fR are passed literally to mysql and mysqladmin. .SS "\s-1READ\s0 \s-1ORDER\s0" .IX Subsection "READ ORDER" The tools read several configuration files in order: .IP "1." 4 The global Percona Toolkit configuration file, \&\fI/etc/percona\-toolkit/percona\-toolkit.conf\fR. All tools read this file, so you should only add options to it that you want to apply to all tools. .IP "2." 4 The global tool-specific configuration file, \fI/etc/percona\-toolkit/TOOL.conf\fR, where \f(CW\*(C`TOOL\*(C'\fR is a tool name like \f(CW\*(C`pt\-query\-digest\*(C'\fR. This file is named after the specific tool you're using, so you can add options that apply only to that tool. .IP "3." 4 The user's own Percona Toolkit configuration file, \&\fI\f(CI$HOME\fI/.percona\-toolkit.conf\fR. All tools read this file, so you should only add options to it that you want to apply to all tools. .IP "4." 4 The user's tool-specific configuration file, \fI\f(CI$HOME\fI/.TOOL.conf\fR, where \f(CW\*(C`TOOL\*(C'\fR is a tool name like \f(CW\*(C`pt\-query\-digest\*(C'\fR. This file is named after the specific tool you're using, so you can add options that apply only to that tool. .SS "\s-1SPECIFYING\s0" .IX Subsection "SPECIFYING" There is a special \f(CW\*(C`\-\-config\*(C'\fR option, which lets you specify which configuration files Percona Toolkit should read. You specify a comma-separated list of files. However, its behavior is not like other command-line options. It must be given \fBfirst\fR on the command line, before any other options. If you try to specify it anywhere else, it will cause an error. Also, you cannot specify \f(CW\*(C`\-\-config=/path/to/file\*(C'\fR; you must specify the option and the path to the file separated by whitespace \&\fIwithout an equal sign\fR between them, like: .PP .Vb 1 \& \-\-config /path/to/file .Ve .PP If you don't want any configuration files at all, specify \f(CW\*(C`\-\-config \*(Aq\*(Aq\*(C'\fR to provide an empty list of files. .SH "DSN (DATA SOURCE NAME) SPECIFICATIONS" .IX Header "DSN (DATA SOURCE NAME) SPECIFICATIONS" Percona Toolkit tools use DSNs to specify how to create a \s-1DBD\s0 connection to a MySQL server. A \s-1DSN\s0 is a comma-separated string of \f(CW\*(C`key=value\*(C'\fR parts, like: .PP .Vb 1 \& h=host1,P=3306,u=bob .Ve .PP The standard key parts are shown below, but some tools add additional key parts. See each tool's documentation for details. .PP Some tools do not use DSNs but still connect to MySQL using options like \&\f(CW\*(C`\-\-host\*(C'\fR, \f(CW\*(C`\-\-user\*(C'\fR, and \f(CW\*(C`\-\-password\*(C'\fR. Such tools uses these options to create a \s-1DSN\s0 automatically, behind the scenes. .PP Other tools uses both DSNs and options like the ones above. The options provide defaults for all DSNs that do not specify the option's corresponding key part. For example, if \s-1DSN\s0 \f(CW\*(C`h=host1\*(C'\fR and option \f(CW\*(C`\-\-port=12345\*(C'\fR are specified, then the tool automatically adds \f(CW\*(C`P=12345\*(C'\fR to \s-1DSN\s0. .SS "\s-1ESCAPING\s0 \s-1VALUES\s0" .IX Subsection "ESCAPING VALUES" DSNs are usually specified on the command line, so shell quoting and escaping must be taken into account. Special characters, like asterisk (\f(CW\*(C`*\*(C'\fR), need to be quoted and/or escaped properly to be passed as literal characters in \&\s-1DSN\s0 values. .PP Since \s-1DSN\s0 parts are separated by commas, literal commas in \s-1DSN\s0 values must be escaped with a single backslash (\f(CW\*(C`\e\*(C'\fR). And since a backslash is the escape character for most shells, two backslashes are required to pass a literal backslash. For example, if the username is literally \f(CW\*(C`my,name\*(C'\fR, it must be specified as \f(CW\*(C`my\e\e,name\*(C'\fR on most shells. This applies to DSNs and DSN-related options like \f(CW\*(C`\-\-user\*(C'\fR. .SS "\s-1KEY\s0 \s-1PARTS\s0" .IX Subsection "KEY PARTS" Many of the tools add more parts to DSNs for special purposes, and sometimes override parts to make them do something slightly different. However, all the tools support at least the following: .IP "A" 4 .IX Item "A" Specifies the default character set for the connection. .Sp Enables character set settings in Perl and MySQL. If the value is \f(CW\*(C`utf8\*(C'\fR, sets Perl's binmode on \s-1STDOUT\s0 to utf8, passes the \f(CW\*(C`mysql_enable_utf8\*(C'\fR option to DBD::mysql, and runs \f(CW\*(C`SET NAMES UTF8\*(C'\fR after connecting to MySQL. Any other value sets binmode on \s-1STDOUT\s0 without the utf8 layer, and runs \f(CW\*(C`SET NAMES\*(C'\fR after connecting to MySQL. .Sp Unfortunately, there is no way from within Perl itself to specify the client library's character set. \f(CW\*(C`SET NAMES\*(C'\fR only affects the server; if the client library's settings don't match, there could be problems. You can use the defaults file to specify the client library's character set, however. See the description of the F part below. .IP "D" 4 .IX Item "D" Specifies the connection's default database. .IP "F" 4 .IX Item "F" Specifies a defaults file the mysql client library (the C client library used by DBD::mysql, \fInot Percona Toolkit itself\fR) should read. The tools all read the [client] section within the defaults file. If you omit this, the standard defaults files will be read in the usual order. \*(L"Standard\*(R" varies from system to system, because the filenames to read are compiled into the client library. On Debian systems, for example, it's usually /etc/mysql/my.cnf then ~/.my.cnf. If you place the following into ~/.my.cnf, tools will Do The Right Thing: .Sp .Vb 3 \& [client] \& user=your_user_name \& pass=secret .Ve .Sp Omitting the F part is usually the right thing to do. As long as you have configured your ~/.my.cnf correctly, that will result in tools connecting automatically without needing a username or password. .Sp You can also specify a default character set in the defaults file. Unlike the \&\*(L"A\*(R" part described above, this will actually instruct the client library (DBD::mysql) to change the character set it uses internally, which cannot be accomplished any other way as far as I know, except for \f(CW\*(C`utf8\*(C'\fR. .IP "h" 4 .IX Item "h" Hostname or \s-1IP\s0 address for the connection. .IP "p" 4 .IX Item "p" Password to use when connecting. .IP "P" 4 .IX Item "P" Port number to use for the connection. Note that the usual special-case behaviors apply: if you specify \f(CW\*(C`localhost\*(C'\fR as your hostname on Unix systems, the connection actually uses a socket file, not a \s-1TCP/IP\s0 connection, and thus ignores the port. .IP "S" 4 .IX Item "S" Socket file to use for the connection (on Unix systems). .IP "u" 4 .IX Item "u" User for login if not current user. .SS "\s-1BAREWORD\s0" .IX Subsection "BAREWORD" Many of the tools will let you specify a \s-1DSN\s0 as a single word, without any \&\f(CW\*(C`key=value\*(C'\fR syntax. This is called a 'bareword'. How this is handled is tool-specific, but it is usually interpreted as the \*(L"h\*(R" part. The tool's \&\f(CW\*(C`\-\-help\*(C'\fR output will tell you the behavior for that tool. .SS "\s-1PROPAGATION\s0" .IX Subsection "PROPAGATION" Many tools will let you propagate values from one \s-1DSN\s0 to the next, so you don't have to specify all the parts for each \s-1DSN\s0. For example, if you want to specify a username and password for each \s-1DSN\s0, you can connect to three hosts as follows: .PP .Vb 1 \& h=host1,u=fred,p=wilma host2 host3 .Ve .PP This is tool-specific. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" The environment variable \f(CW\*(C`PTDEBUG\*(C'\fR enables verbose debugging output to \s-1STDERR\s0. To enable debugging and capture all output to a file, run the tool like: .PP .Vb 1 \& PTDEBUG=1 pt\-table\-checksum ... > FILE 2>&1 .Ve .PP Be careful: debugging output is voluminous and can generate several megabytes of output. .SH "SYSTEM REQUIREMENTS" .IX Header "SYSTEM REQUIREMENTS" Most tools require: .IP "\(bu" 4 Perl v5.8 or newer .IP "\(bu" 4 Bash v3 or newer .IP "\(bu" 4 Core Perl modules like Time::HiRes .PP Tools that connect to MySQL require: .IP "\(bu" 4 Perl modules \s-1DBI\s0 and DBD::mysql .IP "\(bu" 4 MySQL 5.0 or newer .PP Percona Toolkit is only tested on \s-1UNIX\s0 systems, primarily Debian and Red Hat derivatives; other operating systems are not supported. .PP Tools that connect to MySQL may work with MySQL v4.1, but this is not test or supported. .SH "BUGS" .IX Header "BUGS" Please report bugs at https://bugs.launchpad.net/percona\-toolkit . Include the following information in your bug report: .IP "\(bu" 4 Complete command-line used to run the tool .IP "\(bu" 4 Tool \f(CW\*(C`\-\-version\*(C'\fR .IP "\(bu" 4 MySQL version of all servers involved .IP "\(bu" 4 Output from the tool including \s-1STDERR\s0 .IP "\(bu" 4 Input files (log/dump/config files, etc.) .PP If possible, include debugging output by running the tool with \f(CW\*(C`PTDEBUG\*(C'\fR; see \*(L"\s-1ENVIRONMENT\s0\*(R". .SH "AUTHORS" .IX Header "AUTHORS" Percona Toolkit is primarily developed by Baron Schwartz and Daniel Nichter, both of whom are employed by Percona Inc. See each program's documentation for details. .SH "COPYRIGHT, LICENSE, AND WARRANTY" .IX Header "COPYRIGHT, LICENSE, AND WARRANTY" Percona Toolkit is copyright 2011\-2012 Percona Inc. and others. See each program's documentation for complete copyright notices. .PP \&\s-1THIS\s0 \s-1PROGRAM\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \&\s-1MERCHANTABILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation, version 2; \s-1OR\s0 the Perl Artistic License. On \s-1UNIX\s0 and similar systems, you can issue `man perlgpl' or `man perlartistic' to read these licenses. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0. .SH "VERSION" .IX Header "VERSION" Percona Toolkit v2.1.2 released 2012\-06\-12