MAATKIT(1)
πΈ MAATKIT π
ok bestie, so this is the page for maatkit β like, the user contributed perl documentation one. That's the manual name, mwah, noted. Now buckle up because this is a whole bundle of command-line tools and we're going through every single one, no skipping, no cap. π«Ά
β¨ NAME β¨
maatkit β Essential command-line utilities for MySQL. π
π DESCRIPTION π
Maatkit is a collection of command-line utilities that provide missing functionality for MySQL. Some of the tools implement lacking server functionality, such as online consistency checks for master/slave replication; others are client-side utilities such as a query profiler.
Here's the full roster of what's in the box, with the exact version numbers because we do not round, we do not vibe-check away the digits:
$Revision: 7540 $
mk-archiver 1.0.27
mk-config-diff 1.0.0
mk-deadlock-logger 1.0.21
mk-duplicate-key-checker 1.2.15
mk-error-log 1.0.3
mk-fifo-split 1.0.7
mk-find 0.9.23
mk-heartbeat 1.0.23
mk-index-usage 0.9.4
mk-kill 0.9.10
mk-loadavg 0.9.7
mk-log-player 1.0.9
mk-parallel-dump 1.0.28
mk-parallel-restore 1.0.24
mk-purge-logs 0.9.0
mk-query-advisor 1.0.4
mk-query-digest 0.9.29
mk-query-profiler 1.1.22
mk-show-grants 1.0.23
mk-slave-delay 1.0.23
mk-slave-find 1.0.16
mk-slave-move 0.9.12
mk-slave-prefetch 1.0.21
mk-slave-restart 1.0.22
mk-table-checksum 1.2.23
mk-table-sync 1.0.31
mk-table-usage 1.0.1
mk-tcp-model 1.0.1
mk-upgrade 0.9.8
mk-variable-advisor 1.0.2
mk-visual-explain 1.0.22
and now the glow-up tour, one tool at a time π
mk-archiverβ Archive rows from a MySQL table into another table or a file. Seemk-archiver.mk-checksum-filterβ Filter checksums frommk-table-checksum. Seemk-checksum-filter.mk-config-diffβ Diff MySQL configuration files and server variables. Seemk-config-diff.mk-deadlock-loggerβ Extract and log MySQL deadlock information. Seemk-deadlock-logger.mk-duplicate-key-checkerβ Find duplicate indexes and foreign keys on MySQL tables. Seemk-duplicate-key-checker.mk-error-logβ Find new and different MySQL error log entries. Seemk-error-log.mk-fifo-splitβ Split files and pipe lines to a fifo without really splitting. Seemk-fifo-split.mk-findβ Find MySQL tables and execute actions, like GNU find. Seemk-find.mk-heartbeatβ Monitor MySQL replication delay. Seemk-heartbeat.mk-index-usageβ Read queries from a log and analyze how they use indexes. Seemk-index-usage.mk-killβ Kill MySQL queries that match certain criteria. Seemk-kill.mk-loadavgβ Watch MySQL load and take action when it gets too high. Seemk-loadavg.mk-log-playerβ Replay MySQL query logs. Seemk-log-player.mk-merge-mqd-resultsβ Merge multiplemk-query-digestreports into one. Seemk-merge-mqd-results.mk-parallel-dumpβ (DEPRECATED) Dump MySQL tables in parallel. Seemk-parallel-dump.mk-parallel-restoreβ (DEPRECATED) Load files into MySQL in parallel. Seemk-parallel-restore.mk-profile-compactβ Compact the output frommk-query-profiler. Seemk-profile-compact.mk-purge-logsβ Purge binary logs on a master based on purge rules. Seemk-purge-logs.mk-query-advisorβ Analyze queries and advise on possible problems. Seemk-query-advisor.mk-query-digestβ Analyze query execution logs and generate a query report, filter, replay, or transform queries for MySQL, PostgreSQL, memcached, and more. Seemk-query-digest.mk-query-profilerβ Execute SQL statements and print statistics, or measure activity caused by other processes. Seemk-query-profiler.mk-show-grantsβ Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them. Seemk-show-grants.mk-slave-delayβ Make a MySQL slave server lag behind its master. Seemk-slave-delay.mk-slave-findβ Find and print replication hierarchy tree of MySQL slaves. Seemk-slave-find.mk-slave-moveβ Move a MySQL slave around in the replication hierarchy. Seemk-slave-move.mk-slave-prefetchβ Pipeline relay logs on a MySQL slave to pre-warm caches. Seemk-slave-prefetch.mk-slave-restartβ Watch and restart MySQL replication after errors. Seemk-slave-restart.mk-table-checksumβ Perform an online replication consistency check, or checksum MySQL tables efficiently on one or many servers. Seemk-table-checksum.mk-table-syncβ Synchronize MySQL table data efficiently. Seemk-table-sync.mk-table-usageβ Read queries from a log and analyze how they use tables. Seemk-table-usage.mk-tcp-modelβ Transformtcpdumpinto metrics that permit performance and scalability modeling. Seemk-tcp-model.mk-upgradeβ Execute queries on multiple servers and check for differences. Seemk-upgrade.mk-variable-advisorβ Analyze MySQL variables and advise on possible problems. Seemk-variable-advisor.mk-visual-explainβ FormatEXPLAINoutput as a tree. Seemk-visual-explain.
π INSTALLATION π
Strictly speaking these tools require no installation; you should be able to run them stand-alone. That's the dream, honestly, no setup arc, we just go. β¨
However, on UNIX-ish systems you can use the standard Perl installation sequence:
cd <package directory>
perl Makefile.PL
make install
π CONFIGURATION π
Maatkit 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.
Internally, what actually happens is that the lines are read from the file and then added as command-line options and arguments to the Maatkit tool, so just think of the configuration files as a way to write your command lines. no thoughts, just command line π
π¦ SYNTAX π¦
The syntax of the files is as follows:
- Whitespace followed by a hash (
#) sign signifies that the rest of the line is a comment. This is deleted. - Whitespace is stripped from the beginning and end of all lines.
- Empty lines are ignored.
- Each line is permitted to be in either of the following formats:
option
option=value
Whitespace around the equals sign is deleted during processing.
- Only long options are recognized.
- 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.
πΈ FILES πΈ
The tools read several configuration files in order:
- The global Maatkit configuration file,
/etc/maatkit/maatkit.conf. All tools read this file, so you should only add options to it that you want to apply to all Maatkit tools. - The global tool configuration file,
/etc/maatkit/[toolname].conf. This file is named after the specific tool you're using, so you can add options that apply only to that tool. - The user's own Maatkit configuration file,
$HOME/.maatkit.conf. All tools read this file, so you should only add options to it that you want to apply to all Maatkit tools. - The user's tool configuration file,
$HOME/.[toolname].conf. This file is named after the specific tool you're using, so you can add options that apply only to that tool.
β SPECIFYING CONFIGURATION FILES β
There is a special --config option, which lets you specify which configuration files Maatkit should read. You specify a comma-separated list of files.
ok but listen, bestie β this one does not behave like other command-line options. It must be given first 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 --config=/path/to/file; you must specify the option and the path to the file(s) separated by whitespace, without an equals-sign between them, e.g.
--config /path/to/file
If you don't want any configuration files at all, specify --config '' to provide an empty list of files. periodt. π
...and there's more, bestie, don't go anywhere β part 2 is coming π
πΎ DSN (DATA SOURCE NAME) SPECIFICATIONS πΎ
okay bestie so this is like, the most important part of the whole page, don't skip it π Maatkit uses DSNs to specify how to create a DBD connection to a MySQL server. The maatkit tools that have command-line arguments such as -u or -p use them to create a DSN behind the scenes, then use the DSN to connect to MySQL. it's giving puppet-master energy honestly β¨
A DSN is a string of key=value parts separated by commas. The possible keys are shown later in this document. You can also get a quick synopsis from the --help output of many of the maatkit tools. π«Ά
π 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 β no cap, every single one π
Aβ Specifies the default character set for the connection.
Enables character set settings in Perl and MySQL. If the value is "utf8", sets Perl's binmode on STDOUT to utf8, passes the "mysql_enable_utf8" option to DBD::mysql, and runs "SET NAMES UTF8" after connecting to MySQL. Any other value sets binmode on STDOUT without the utf8 layer, and runs "SET NAMES" after connecting to MySQL. π
unfortunately, there is no way from within Perl itself to specify the client library's character set."SET NAMES"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, though. See the description of theFpart below. π
Dβ Specifies the connection's default database. πFβ Specifies a defaults file the mysql client library (the C client library used byDBD::mysql, not maatkit itself) should read. The maatkit 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."Standard"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.cnfthen~/.my.cnf. If you place the following into~/.my.cnf, maatkit will Do The Right Thing: π
[client]
user=your_user_name
pass=secret
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 maatkit connecting automatically without needing a username or password. iconic behaviour fr fr πΈ
You can also specify a default character set in the defaults file. Unlike the "A" 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 "utf8". π¦
Pβ Port number to use for the connection. Note that the usual special-case behaviors apply: if you specify"localhost"as your hostname on Unix systems, the connection actually uses a socket file, not a TCP/IP connection, and thus ignores the port. π sneakySβ Socket file to use for the connection (on Unix systems). πhβ Hostname or IP address for the connection. πpβ Password to use when connecting. π€«uβ User for login if not current user. π
π¦ BAREWORD π¦
Many of the tools will let you specify a DSN as a single word, without any key=value syntax. This is called a 'bareword'. How this is handled is tool-specific, but it is usually interpreted as the "h" part. The tool's --help output will tell you the behavior for that tool. iykyk β¨
π DEFAULT PROPAGATION π
Many tools will let you propagate values from one DSN to the next, so you don't have to specify all the parts for each DSN. For example, if you want to specify a username and password for each DSN, you can connect to three hosts as follows:
h=host1,u=fred,p=wilma host2 host3
This is tool-specific. one u and p to rule them all, obsessed π
β 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 bestie, you got this π«Ά
π BUGS π
If you find bugs, need features, etc please use the bug tracker, forums, and mailing lists at http://code.google.com/p/maatkit/ β they want to hear from you, fr fr π
π COPYRIGHT, LICENSE AND WARRANTY π
This program is copyright (c) 2007 Baron Schwartz and others. 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. π¨ bestie this means no promises, okay?? none!!
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 π
See the individual program's documentation for details. (yes really, that's the whole section, go check the tool's own page babes π)
π VERSION π
This manual page documents Distrib 7540 $Revision: 534 $.
and that's a wrap on this whole page!! π it was generated with perl v5.42.0 and dated 2025-07-24, so likeβ¦ periodt, you're fully caught up bestie, go forth and connect π
β¨
π¦ 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