.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PERCONA-TOOLKIT 1p" .TH PERCONA-TOOLKIT 1p "2020-08-30" "perl v5.30.3" "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 for MySQL .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. 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" Log MySQL deadlocks. .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" 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-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-digest" 4 .IX Item "pt-query-digest" Analyze MySQL queries from logs, processlist, and tcpdump. .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-stalk. .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" Collect forensic data about MySQL when problems occur. .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-upgrade" 4 .IX Item "pt-upgrade" Verify that query results are identical on different servers. .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 "SPECIAL OPTION TYPES" .IX Header "SPECIAL OPTION TYPES" Tool options use standard types (\f(CW\*(C`int\*(C'\fR, \f(CW\*(C`string\*(C'\fR, etc.) as well as these special types: .IP "time" 4 .IX Item "time" Time values are seconds by default. For example, \f(CW\*(C`\-\-run\-time 60\*(C'\fR means 60 seconds. Time values support an optional suffix: s (seconds), m (minutes), h (hours), d (days). \f(CW\*(C`\-\-run\-time 1m\*(C'\fR means 1 minute (the same as 60 seconds). .IP "size" 4 .IX Item "size" Size values are bytes by default. For example, \f(CW\*(C`\-\-disk\-space\-free 1024\*(C'\fR means 1 Kibibyte. Size values support an optional suffix: k (Kibibyte), M (Mebibyte), G (Gibibyte). .IP "\s-1DSN\s0" 4 .IX Item "DSN" See \*(L"\s-1DSN\s0 (\s-1DATA SOURCE NAME\s0) \s-1SPECIFICATIONS\*(R"\s0. .IP "Hash, hash, Array, array" 4 .IX Item "Hash, hash, Array, array" Hash, hash, Array, and array values are comma-separated lists of values. For example, \f(CW\*(C`\-\-ignore\-tables foo,bar\*(C'\fR ignores tables \f(CW\*(C`foo\*(C'\fR and \f(CW\*(C`bar\*(C'\fR. .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 ORDER\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 VALUES\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 PARTS\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" Default character set for the connection (\f(CW\*(C`SET NAMES\*(C'\fR). .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 \*(Aqutf8\*(Aq\*(C'\fR after connecting to MySQL. Other values set binmode on \s-1STDOUT\s0 without the utf8 layer and run \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" Default database to use when connecting. Tools may \f(CW\*(C`USE\*(C'\fR a different databases while running. .IP "F" 4 .IX Item "F" Defaults file for the MySQL client library (the C client library used by DBD::mysql, \fInot Percona Toolkit itself\fR). All tools all read the \&\f(CW\*(C`[client]\*(C'\fR 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 \f(CW\*(C`/etc/mysql/my.cnf\*(C'\fR then \&\f(CW\*(C`~/.my.cnf\*(C'\fR. If you place the following in \f(CW\*(C`~/.my.cnf\*(C'\fR, you won't have to specify your MySQL username and password on the command line: .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 \f(CW\*(C`~/.my.cnf\*(C'\fR 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. .IP "h" 4 .IX Item "h" MySQL hostname or \s-1IP\s0 address to connect to. .IP "L" 4 .IX Item "L" Explicitly enable \s-1LOAD DATA LOCAL INFILE.\s0 .Sp For some reason, some vendors compile libmysql without the \&\-\-enable\-local\-infile option, which disables the statement. This can lead to weird situations, like the server allowing \s-1LOCAL INFILE,\s0 but the client throwing exceptions if it's used. .Sp However, as long as the server allows \s-1LOAD DATA,\s0 clients can easily re-enable it; see and . This option does exactly that. .IP "p" 4 .IX Item "p" MySQL 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" MySQL socket file to use for the connection (on Unix systems). .IP "u" 4 .IX Item "u" MySQL username to use when connecting, if not current system 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 officially supports and is tested on many popular Linux distributions and MySQL 5.0 through 5.6; see http://goo.gl/srHm7 for the list of supported platforms and versions. .SH "IPv6 support" .IX Header "IPv6 support" In order to support IPv6 addresses to connect to MySQL, Perl DBD::MySQL driver v4.033_01 is required. Also, as stated in \s-1RFC 3986\s0 section 3.2.2 brackes must be used to distinguish host and port. Examples: .SH "BUGS" .IX Header "BUGS" Please report bugs at . 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\*(R"\s0. .SH "AUTHORS" .IX Header "AUTHORS" .IP "Baron Schwartz" 4 .IX Item "Baron Schwartz" Baron created Maatkit, from which Percona Toolkit was forked. Many of the tools and modules were originally written by Baron. .IP "Daniel Nichter" 4 .IX Item "Daniel Nichter" Daniel has been the project's lead developer since 2008 until 2016. .IP "Frank Cizmich" 4 .IX Item "Frank Cizmich" Frank was a full-time Percona Toolkit developer employed by Percona until 2016. .IP "Carlos Salguero" 4 .IX Item "Carlos Salguero" Carlos has been the project's lead developer since 2016. He is hired by Percona. .IP "Others" 4 .IX Item "Others" Many people have contributed code over the years. See each tool's \&\*(L"\s-1AUTHORS\*(R"\s0 section for details. .SH "COPYRIGHT, LICENSE, AND WARRANTY" .IX Header "COPYRIGHT, LICENSE, AND WARRANTY" Percona Toolkit is copyright 2011\-2020 Percona \s-1LLC\s0 and/or its affiliates, et al. See each program's documentation for complete copyright notices. .PP \&\s-1THIS PROGRAM IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\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 v3.2.1 released 2020\-08\-12