
Percona Toolkit Documentation Release 2.2.15 2015, Percona LLC and/or its affiliates August 28, 2015 CONTENTS 1 Getting Percona Toolkit 3 1.1 Installation................................................3 2 Tools 5 2.1 pt-align ..................................................5 2.2 pt-archiver ................................................7 2.3 pt-config-diff ............................................... 26 2.4 pt-deadlock-logger ........................................... 31 2.5 pt-diskstats ............................................... 39 2.6 pt-duplicate-key-checker ........................................ 48 2.7 pt-fifo-split ................................................ 54 2.8 pt-find .................................................. 57 2.9 pt-fingerprint .............................................. 67 2.10 pt-fk-error-logger ............................................ 71 2.11 pt-heartbeat ............................................... 77 2.12 pt-index-usage .............................................. 87 2.13 pt-ioprofile ................................................ 96 2.14 pt-kill ................................................... 99 2.15 pt-mext .................................................. 112 2.16 pt-mysql-summary ........................................... 115 2.17 pt-online-schema-change ........................................ 124 2.18 pt-pmp .................................................. 139 2.19 pt-query-digest ............................................. 142 2.20 pt-show-grants ............................................. 167 2.21 pt-sift ................................................... 172 2.22 pt-slave-delay .............................................. 175 2.23 pt-slave-find ............................................... 181 2.24 pt-slave-restart ............................................. 187 2.25 pt-stalk .................................................. 195 2.26 pt-summary ............................................... 205 2.27 pt-table-checksum ............................................ 211 2.28 pt-table-sync ............................................... 230 2.29 pt-table-usage .............................................. 248 2.30 pt-upgrade ................................................ 255 2.31 pt-variable-advisor ........................................... 266 2.32 pt-visual-explain ............................................ 278 3 Configuration 291 3.1 CONFIGURATION FILES....................................... 291 3.2 DSN (DATA SOURCE NAME) SPECIFICATIONS.......................... 292 3.3 ENVIRONMENT............................................ 295 i 3.4 SYSTEM REQUIREMENTS...................................... 295 4 Miscellaneous 297 4.1 BUGS.................................................. 297 4.2 AUTHORS................................................ 297 4.3 COPYRIGHT, LICENSE, AND WARRANTY............................. 297 4.4 VERSION................................................ 298 4.5 Release Notes.............................................. 298 Index 355 ii Percona Toolkit Documentation, Release 2.2.15 Percona Toolkit is a collection of advanced command-line tools used by Percona (http://www.percona.com/) support staff to perform a variety of MySQL and system tasks that are too difficult or complex to perform manually. These tools are ideal alternatives to private or “one-off” 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. 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 http://www.percona.com/software/. CONTENTS 1 Percona Toolkit Documentation, Release 2.2.15 2 CONTENTS CHAPTER ONE GETTING PERCONA TOOLKIT 1.1 Installation Visit http://www.percona.com/software/percona-toolkit/ to download the latest release of Percona Toolkit. Or, get the latest release from the command line: wget percona.com/get/percona-toolkit.tar.gz wget percona.com/get/percona-toolkit.rpm wget percona.com/get/percona-toolkit.deb You can also get individual tools from the latest release: wget percona.com/get/TOOL Replace TOOL with the name of any tool. 3 Percona Toolkit Documentation, Release 2.2.15 4 Chapter 1. Getting Percona Toolkit CHAPTER TWO TOOLS 2.1 pt-align 2.1.1 NAME pt-align - Align output from other tools to columns. 2.1.2 SYNOPSIS Usage pt-align [FILES] pt-align aligns output from other tools to columns. If no FILES are specified, STDIN is read. If a tool prints the following output, DATABASE TABLE ROWS foo bar 100 long_db_name table 1 another long_name 500 then pt-align reprints the output as, DATABASE TABLE ROWS foo bar 100 long_db_name table 1 another long_name 500 2.1.3 RISKS Percona Toolkit is mature, proven in the real world, and well tested, but all database tools can pose a risk to the system and the database server. Before using this tool, please: • Read the tool’s documentation • Review the tool’s known “BUGS” • Test the tool on a non-production server • Backup your production server and verify the backups 5 Percona Toolkit Documentation, Release 2.2.15 2.1.4 DESCRIPTION pt-align reads lines and splits them into words. It counts how many words each line has, and if there is one number that predominates, it assumes this is the number of words in each line. Then it discards all lines that don’t have that many words, and looks at the 2nd line that does. It assumes this is the first non-header line. Based on whether each word looks numeric or not, it decides on column alignment. Finally, it goes through and decides how wide each column should be, and then prints them out. This is useful for things like aligning the output of vmstat or iostat so it is easier to read. 2.1.5 OPTIONS This tool accepts additional command-line arguments. Refer to the “SYNOPSIS” and usage information for details. --help Show help and exit. --version Show version and exit. 2.1.6 ENVIRONMENT This tool does not use any environment variables. 2.1.7 SYSTEM REQUIREMENTS You need Perl, and some core packages that ought to be installed in any reasonably new version of Perl. 2.1.8 BUGS For a list of known bugs, see http://www.percona.com/bugs/pt-align. Please report bugs at https://bugs.launchpad.net/percona-toolkit. Include the following information in your bug report: • Complete command-line used to run the tool • Tool --version • MySQL version of all servers involved • Output from the tool including STDERR • Input files (log/dump/config files, etc.) If possible, include debugging output by running the tool with PTDEBUG; see “ENVIRONMENT”. 2.1.9 DOWNLOADING Visit http://www.percona.com/software/percona-toolkit/ to download the latest release of Percona Toolkit. Or, get the latest release from the command line: 6 Chapter 2. Tools Percona Toolkit Documentation, Release 2.2.15 wget percona.com/get/percona-toolkit.tar.gz wget percona.com/get/percona-toolkit.rpm wget percona.com/get/percona-toolkit.deb You can also get individual tools from the latest release: wget percona.com/get/TOOL Replace TOOL with the name of any tool. 2.1.10 AUTHORS Baron Schwartz, Brian Fraser, and Daniel Nichter 2.1.11 ABOUT PERCONA TOOLKIT This tool is part of Percona Toolkit, a collection of advanced command-line tools for MySQL developed by Percona. Percona Toolkit was forked from two projects in June, 2011: Maatkit and Aspersa. Those projects were created by Baron Schwartz and primarily developed by him and Daniel Nichter. Visit http://www.percona.com/software/ to learn about other free, open-source software from Percona. 2.1.12 COPYRIGHT, LICENSE, AND WARRANTY This program is copyright 2011-2015 Percona LLC and/or its affiliates, 2010-2011 Baron Schwartz. THIS PROGRAM IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, IN- CLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License. On UNIX and similar systems, you can issue ‘man perlgpl’ or ‘man perlartistic’ to read these licenses. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 2.1.13 VERSION pt-align 2.2.15 2.2 pt-archiver 2.2.1 NAME pt-archiver - Archive rows from a MySQL table into another table or a file. 2.2. pt-archiver 7 Percona Toolkit Documentation, Release 2.2.15 2.2.2 SYNOPSIS Usage pt-archiver [OPTIONS] --source DSN --where WHERE pt-archiver nibbles records from a MySQL table. The –source and –dest arguments use DSN syntax; if COPY is yes, –dest defaults to the key’s value from –source. Examples Archive all rows from oltp_server to olap_server and to a file: pt-archiver --sourceh=oltp_server,D=test,t=tbl --desth=olap_server \ --file '/var/log/archive/%Y-%m-%d-%D.%t' \ --where "1=1" --limit 1000 --commit-each Purge (delete) orphan rows from child table: pt-archiver --sourceh=host,D=db,t=child --purge \ --where 'NOT EXISTS(SELECT * FROM parent WHERE col=child.col)' 2.2.3 RISKS Percona Toolkit is mature, proven in the real world, and well tested, but all database tools can pose a risk to the system and
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages379 Page
-
File Size-