MK-SLAVE-FIND(1)
๐ MK-SLAVE-FIND ๐
okay bestie, gather round, because this is mk-slave-find, a page from the User Contributed Perl Documentation corner of the manual universe, and it is genuinely iconic. it finds your MySQL slaves and draws you the whole replication family tree. no cap. ๐ณโจ
๐ฆ NAME ๐ฆ
mk-slave-find โ find and print the replication hierarchy tree of MySQL slaves. that's it, that's the whole job, and she does it gorgeously ๐
๐ธ SYNOPSIS ๐ธ
Usage: mk-slave-find [OPTION...] MASTER-HOST
mk-slave-find finds and prints a hierarchy tree of MySQL slaves. lowkey a whole genealogy moment for your database.
Examples:
mk-slave-find --host master-host
๐ RISKS ๐
bestie, this section exists to tell you the ~potential risks~, known or unknown, of using this tool. the two main categories are: (1) risks from the nature of the tool (like, read-only tools vs. read-write tools, huge difference, we love a safe queen) and (2) risks that come from bugs.
good news: mk-slave-find is read-only and very low-risk. she's a looker, not a toucher. ๐ซถ
at the time of this release, we know of no bugs that could cause serious harm to users. slay.
the authoritative source for updated info is always the online issue tracking system. issues that affect this tool will be marked as such. you can peep the list of those issues at:
<http://www.maatkit.org/bugs/mk-slave-find>
see also "BUGS" below for more info on filing bugs and getting help. ๐
โจ DESCRIPTION โจ
mk-slave-find connects to a MySQL replication master and finds its slaves. currently the only thing it can do is print a tree-like view of the replication hierarchy. (one trick, but she does it flawlessly.)
you can specify the master host in one of two ways, bestie, pick your fighter:
method one: use the standard connection-related command line options: --defaults-file, --password, --host, --port, --socket or --user.
method two: specify the master host as a DSN. a DSN is a special syntax that can be either just a hostname (like server.domain.com or 1.2.3.4), or a key=value,key=value string. 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, mk-slave-find reads all normal MySQL option files, such as ~/.my.cnf, so you may 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) indicates success. any other value represents the exit status of the Perl process itself. so 0 = we ate, anything else = the Perl process is having a moment. ๐ญ
๐ 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. she'll ask, politely.--charsetโ short form:-A; type: string. default character set. if the value isutf8, it sets Perl'sbinmodeonSTDOUTto utf8, passes themysql_enable_utf8option toDBD::mysql, and runsSET NAMES UTF8after connecting to MySQL. any other value setsbinmodeonSTDOUTwithout the utf8 layer, and runsSET NAMESafter connecting to MySQL. utf8 girlies, we see you ๐--configโ type: Array. read this comma-separated list of config files; if specified, this must be the first option on the command line. first, bestie. FIRST. no cutting the line. ๐--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. the classic.--hostโ short form:-h; type: string. connect to host.--passwordโ short form:-p; type: string. password to use when connecting.--pidโ type: string. create the given PID file. the file contains the process ID of the script. the PID file is removed when the script exits. before starting, the script checks if the PID file already exists. if it does not, then the script creates and writes its own PID to it. if it does, then the script checks the following: if the file contains a PID and a process is running with that PID, then the script dies; or, if there is no process running with that PID, then the script overwrites the file with its own PID and starts; else, if the file contains no PID, then the script dies. dramatic? yes. correct? also yes. ๐--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. (infinite recursion, the main character energy we deserve ๐) see--recursion-method.--recursion-methodโ type: string. preferred recursion method used to find slaves. possible methods are:
METHOD USES
=========== ================
processlist SHOW PROCESSLIST
hosts SHOW SLAVE HOSTS
the processlist method is preferred because SHOW SLAVE HOSTS is not reliable. however, the hosts method is required if the server uses a non-standard port (not 3306). usually mk-slave-find does the right thing and finds the slaves, but you may give a preferred method and it will be used first. if it doesn't find any slaves, the other methods will be tried. she's thorough like that. ๐
--report-formatโ type: string; default:summary. set what information about the slaves is printed. the report format can be one of the following:hostnameโ print just the hostname of the slaves. it looks like:
127.0.0.1:12345
+- 127.0.0.1:12346
+- 127.0.0.1:12347
summaryโ print a summary of each slave's settings. this report shows more information about each slave, 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 slave, has 1 slaves 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 slave, has 1 slaves connected
Filters
Binary logging STATEMENT
Slave status 0 seconds behind, running, no errors
Slave mode STRICT
Auto-increment increment 1, offset 1
--set-varsโ type: string; default:wait_timeout=10000. set these MySQL variables. immediately after connecting to MySQL, this string will be appended toSETand executed.--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 (she said what she said). 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 maatkit 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.Pโ 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.
๐ง DOWNLOADING ๐ง
you can download Maatkit from Google Code at <http://code.google.com/p/maatkit/>, or you can get any of the tools easily with a command like the following:
wget http://www.maatkit.org/get/toolname
or
wget http://www.maatkit.org/trunk/toolname
where toolname can be replaced with the name (or fragment of a name) of any of the Maatkit tools. once downloaded, they're ready to run; no installation is needed. the first URL gets the latest released version of the tool, and the second gets the latest trunk code from Subversion. instant gratification, no build step, we love to see it. โญ
๐ ENVIRONMENT ๐
the environment variable MKDEBUG enables verbose debugging output in all of the Maatkit tools:
MKDEBUG=1 mk-....
๐ 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 the whole shopping list.
๐ญ BUGS ๐ญ
for a list of known bugs see <http://www.maatkit.org/bugs/mk-slave-find>.
please use Google Code Issues and Groups to report bugs or request support: <http://code.google.com/p/maatkit/>. you can also join #maatkit on Freenode to discuss Maatkit.
please include the complete command-line used to reproduce the problem you are seeing, the version of all MySQL servers involved, the complete output of the tool when run with --version, and if possible, debugging output produced by running with the MKDEBUG=1 environment variable. give them the receipts, bestie, they can't fix what they can't see. ๐ซถ
๐ COPYRIGHT, LICENSE AND WARRANTY ๐
this program is copyright 2007-2011 Baron Schwartz. feedback and improvements are welcome.
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.
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.
๐ AUTHOR ๐
Baron Schwartz
๐ ABOUT MAATKIT ๐
this tool is part of Maatkit, a toolkit for power users of MySQL. Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the primary code contributors. both are employed by Percona. financial support for Maatkit development is primarily provided by Percona and its clients. shoutout to the sponsors, fr fr. ๐
โญ VERSION โญ
this manual page documents Ver 1.0.16 Distrib 7540 $Revision: 7531 $.
and that's the whole page, bestie!! ๐ฆ this lil doc was brought to you by perl v5.42.0, dated 2025-07-24 โ mwah, go find those slaves, you've got this. ๐ โจ
๐ฆ where this page comes from
- fedora 43: maatkit 7540-39.fc43 ยท GPL-2.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms