PT-SLAVE-FIND(1)
π¦ PT-SLAVE-FIND(1) π¦ β User Contributed Perl Documentation
okay so quick heads up before anything else, bestie: this page lives in the User Contributed Perl Documentation section, and the tool you're actually reading about is called pt-replica-find. the file name still says pt-slave-find (legacy vibes π) but the tool itself goes by pt-replica-find. iykyk. anyway, let's get into it β¨
π NAME π
pt-replica-find β find and print the replication hierarchy tree of MySQL replicas.
it's giving genealogy.com but for your databases π³π
πΈ SYNOPSIS πΈ
Usage: pt-replica-find [OPTIONS] [DSN]
pt-replica-find finds a hierarchy tree of MySQL replicas and prints it. that's literally the whole thing it does right now and honestly? iconic.
Examples:
pt-replica-find --host source-host
π¨ RISKS π¨
bestie. listen. 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. no cap. so before you use 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
the last two are not optional, fr fr. back it up and verify the backup. do not skip the verify. π
β¨ DESCRIPTION β¨
pt-replica-find connects to a MySQL replication source and finds its replicas. currently the only thing it can do is print a tree-like view of the replication hierarchy β but it does that one thing so well π«Ά
you've got two whole methods for telling it which source host to talk to. pick your fighter:
- the standard connection-related command line options:
--defaults-file,--password,--host,--port,--socketor--user. - a DSN. a DSN is a special syntax that can be either just a hostname (like
server.domain.comor1.2.3.4), or akey=value,key=valuestring. the keys are a single letter:
KEY MEANING
=== =======
h Connect to host
P Port number to use for connection
S Socket file to use for connection
u User for login if not current user
p Password to use when connecting
F Only read default options from the given file
also!! pt-replica-find reads all normal MySQL option files, such as ~/.my.cnf, so you might not even need to specify username, password and other common options at all. she just knows. β¨
π EXIT STATUS π
an exit status of 0 (sometimes also called a return value or return code) means success π. any other value represents the exit status of the Perl process itself. so like, not her fault, that's the Perl process's drama.
π OPTIONS π
this tool accepts additional command-line arguments. refer to the "SYNOPSIS" and usage information for details.
--ask-passβ prompt for a password when connecting to MySQL. very "who are you, what's the password" of it.--[no]buffer-stdoutβ default: yes. enables STDOUT buffering. disable this option if you want to see live progress when you're using output post-processing tools such asteeorkubectl logs. (yes,kubectl logsβ she contains multitudes βοΈ)--charsetβ short form:-A; type: string. default character set. if the value isutf8, it sets Perl'sbinmodeon STDOUT to utf8, passes themysql_enable_utf8option toDBD::mysql, and runsSET NAMES UTF8after connecting to MySQL. any other value setsbinmodeon STDOUT without the utf8 layer, and runsSET NAMESafter connecting to MySQL.--configβ type: Array. read this comma-separated list of config files; if you specify it, it must be the first option on the command line. first-option energy π--databaseβ type: string; short form:-D. database to use.--defaults-fileβ short form:-F; type: string. only read mysql options from the given file. you must give an absolute pathname.--helpβ show help and exit.--hostβ short form:-h; type: string. connect to host.--mysql_sslβ short form:-s; type: int. create SSL MySQL connection. secure the bag π--passwordβ short form:-p; type: string. password to use when connecting. if the password contains commas they must be escaped with a backslash:exam\,ple--pidβ type: string. create the given PID file. the tool won't start if the PID file already exists and the PID it contains is different than the current PID. however, if the PID file exists and the PID it contains is no longer running, the tool will overwrite the PID file with the current PID. the PID file is removed automatically when the tool exits.--portβ short form:-P; type: int. port number to use for connection.--recurseβ type: int. number of levels to recurse in the hierarchy. default is infinite. see--recursion-method.--recursion-methodβ type: array; default:processlist,hosts. preferred recursion method used to find replicas. possible methods are:
METHOD USES
=========== ==================
processlist SHOW PROCESSLIST
hosts SHOW REPLICAS (SHOW SLAVE HOSTS before MySQL 8.1)
none Do not find replicas
the processlist method is preferred because SHOW REPLICAS is not reliable. however, the hosts method is required if the server uses a non-standard port (not 3306). usually pt-replica-find does the right thing and finds the replicas, but you may give a preferred method and it will be used first. if it doesn't find any replicas, the other methods will be tried. she's persistent like that πͺ
--report-formatβ type: string; default:summary. set what information about the replicas is printed. the report format can be one of the following:hostnameβ print just the hostname name of the replicas. it looks like:
127.0.0.1:12345
+- 127.0.0.1:12346
+- 127.0.0.1:12347
summaryβ print a summary of each replica's settings. this report shows more information about each replica, like:
127.0.0.1:12345
Version 5.1.34-log
Server ID 12345
Uptime 04:56 (started 2010-06-17T11:21:22)
Replication Is not a replica, has 1 replicas connected
Filters
Binary logging STATEMENT
Slave status
Slave mode STRICT
Auto-increment increment 1, offset 1
+- 127.0.0.1:12346
Version 5.1.34-log
Server ID 12346
Uptime 04:54 (started 2010-06-17T11:21:24)
Replication Is a replica, has 1 replicas connected
Filters
Binary logging STATEMENT
Slave status 0 seconds behind, running, no errors
Slave mode STRICT
Auto-increment increment 1, offset 1
--resolve-addressβ resolve ip-address to hostname. report will print both IP and hostname. example:
10.10.7.14 (dbase1.sample.net)
heads up: might delay runtime a few seconds. she's doing DNS homework, give her a sec β³
--slave-userβ type: string. this option is deprecated and will be removed in future releases. use--replica-userinstead. (we don't say "slave" anymore bestie, we've evolved π¦)--slave-passwordβ type: string. this option is deprecated and will be removed in future releases. use--replica-passwordinstead.--replica-userβ type: string. sets the user to be used to connect to the replicas. this parameter allows you to have a different user with less privileges on the replicas, but that user must exist on all replicas. no favorites, everybody gets the same user β¨--replica-passwordβ type: string. sets the password to be used to connect to the replicas. it can be used with--replica-userand the password for the user must be the same on all replicas.--set-varsβ type: Array. set the MySQL variables in this comma-separated list ofvariable=valuepairs. by default, the tool sets:
wait_timeout=10000
variables specified on the command line override these defaults. for example, specifying --set-vars wait_timeout=500 overrides that default of 10000. the tool prints a warning and continues if a variable cannot be set. (she tries her best and moves on π
)
--socketβ short form:-S; type: string. socket file to use for connection.--userβ short form:-u; type: string. user for login if not current user.--versionβ show version and exit.
π§ DSN OPTIONS π§
these DSN options are used to create a DSN. each option is given like option=value. the options are case-sensitive, so P and p are not the same option (rude of them, but okay). there cannot be whitespace before or after the = and if the value contains whitespace it must be quoted. DSN options are comma-separated. see the percona-toolkit manpage for full details.
Aβ dsn:charset; copy: yes. default character set.Dβ dsn:database; copy: yes. default database.Fβ dsn:mysql_read_default_file; copy: yes. only read default options from the given file.hβ dsn:host; copy: yes. connect to host.pβ dsn:password; copy: yes. password to use when connecting. if the password contains commas they must be escaped with a backslash:exam\,plePβ dsn:port; copy: yes. port number to use for connection.Sβ dsn:mysql_socket; copy: yes. socket file to use for connection.uβ dsn:user; copy: yes. user for login if not current user.sβ dsn:mysql_ssl; copy: yes. create SSL connection.
π ENVIRONMENT π
the environment variable PTDEBUG enables verbose debugging output to STDERR. to enable debugging and capture all output to a file, run the tool like:
PTDEBUG=1 pt-replica-find ... > FILE 2>&1
be careful: debugging output is voluminous and can generate several megabytes of output. like, she will not stop talking. π several. megabytes.
π ATTENTION π
using PTDEBUG might expose passwords. when debug is enabled, all command line parameters are shown in the output.
read that again. all command line parameters. so if you were about to paste your debug dump into the group chatβ¦ don't π
β SYSTEM REQUIREMENTS β
you need Perl, DBI, DBD::mysql, and some core packages that ought to be installed in any reasonably new version of Perl. that's it, that's the list.
π BUGS π
for a list of known bugs, see <https://jira.percona.com/projects/PT/issues>.
please report bugs at <https://jira.percona.com/projects/PT>. 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". the more context you give, the faster somebody can actually help you π«Ά
π DOWNLOADING π
visit <http://www.percona.com/software/percona-toolkit/> to download the latest release of Percona Toolkit. or, get the latest release straight 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. mix and match, go off π
πΈ AUTHORS πΈ
Baron Schwartz and Daniel Nichter
(part 1 done β there's more coming, don't go anywhere π«Ά)
β¨ ABOUT PERCONA TOOLKIT β¨
Okay so context bestie, this tool is part of Percona Toolkit β a whole collection of advanced command-line tools for MySQL, all cooked up by Percona π«Ά.
Fun lore drop: Percona Toolkit got forked from two projects back in June, 2011 β Maatkit and Aspersa. Those projects were created by Baron Schwartz and were mainly developed by him and Daniel Nichter. Iconic lineage, honestly.
Wanna learn about other free, open-source software from Percona? Visit <http://www.percona.com/software/> π
π COPYRIGHT, LICENSE, AND WARRANTY π
This program is copyright 2011-2026 Percona LLC and/or its affiliates, 2007-2011 Baron Schwartz.
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
That's the legal voice talking, not me β but yeah, no warranty, fr fr π
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, version 2 along with this program; if not, see <https://www.gnu.org/licenses/>.
β VERSION β
pt-replica-find 3.7.1-4
And that's the whole page bestie, you made it to the end π¦β¨ This was pt-replica-find version 3.7.1-4, served up on 2026-09-01 (the man page's own date, cute right?) with perl v5.42.2 doing the rendering. Go find those replicas ππ
π¦ where this page comes from
- arch rolling: percona-toolkit 3.7.1_4-1 Β· GPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms