14
pt-fk-error-logger - Extract and log MySQL foreign key errors.
22
Usage: pt-fk-error-logger [OPTION...] SOURCE_DSN
24
pt-fk-error-logger extracts and saves information about the most recent foreign
25
key errors in a MySQL server.
27
Print foreign key errors on host1:
32
pt-fk-error-logger h=host1
35
Save foreign key errors on host1 to db.foreign_key_errors table on host2:
40
pt-fk-error-logger h=host1 --dest h=host1,D=db,t=foreign_key_errors
49
The following section is included to inform users about the potential risks,
50
whether known or unknown, of using this tool. The two main categories of risks
51
are those created by the nature of the tool (e.g. read-only tools vs. read-write
52
tools) and those created by bugs.
54
pt-fk-error-logger is read-only unless you specify "--dest". It should be
57
At the time of this release, we know of no bugs that could cause serious harm to
60
The authoritative source for updated information is always the online issue
61
tracking system. Issues that affect this tool will be marked as such. You can
62
see a list of such issues at the following URL:
63
`http://www.percona.com/bugs/pt-fk-error-logger <http://www.percona.com/bugs/pt-fk-error-logger>`_.
65
See also "BUGS" for more information on filing bugs and getting help.
73
pt-fk-error-logger prints or saves the foreign key errors text from
74
\ ``SHOW INNODB STATUS``\ . The errors are not parsed or interpreted in any
75
way. Foreign key errors are uniquely identified by their timestamp.
76
Only new (more recent) errors are printed or saved.
84
If "--print" is given or no "--dest" is given, then pt-fk-error-logger
85
prints the foreign key error text to STDOUT exactly as it appeared in
86
\ ``SHOW INNODB STATUS``\ .
94
This tool accepts additional command-line arguments. Refer to the
95
"SYNOPSIS" and usage information for details.
100
Prompt for a password when connecting to MySQL.
106
short form: -A; type: string
108
Default character set. If the value is utf8, sets Perl's binmode on
109
STDOUT to utf8, passes the mysql_enable_utf8 option to DBD::mysql, and runs SET
110
NAMES UTF8 after connecting to MySQL. Any other value sets binmode on STDOUT
111
without the utf8 layer, and runs SET NAMES after connecting to MySQL.
119
Read this comma-separated list of config files; if specified, this must be the
120
first option on the command line.
126
Fork to the background and detach from the shell. POSIX operating systems only.
132
short form: -F; type: string
134
Only read mysql options from the given file. You must give an absolute
143
DSN for where to store foreign key errors; specify at least a database (D) and table (t).
145
Missing values are filled in with the same values from the source host, so you
146
can usually omit most parts of this argument if you're storing foreign key
147
errors on the same server on which they happen.
149
The following table is suggested:
154
CREATE TABLE foreign_key_errors (
155
ts datetime NOT NULL,
161
The only information saved is the timestamp and the foreign key error text.
173
short form: -h; type: string
181
type: time; default: 0
183
How often to check for foreign key errors.
191
Print all output to this file when daemonized.
197
short form: -p; type: string
199
Password to use when connecting.
207
Create the given PID file when daemonized. The file contains the process ID of
208
the daemonized instance. The PID file is removed when the daemonized instance
209
exits. The program checks for the existence of the PID file when starting; if
210
it exists and the process with the matching PID exists, the program exits.
216
short form: -P; type: int
218
Port number to use for connection.
224
Print results on standard output. See "OUTPUT" for more.
232
How long to run before exiting.
238
type: string; default: wait_timeout=10000
240
Set these MySQL variables. Immediately after connecting to MySQL, this string
241
will be appended to SET and executed.
247
short form: -S; type: string
249
Socket file to use for connection.
255
short form: -u; type: string
257
User for login if not current user.
263
Show version and exit.
273
These DSN options are used to create a DSN. Each option is given like
274
\ ``option=value``\ . The options are case-sensitive, so P and p are not the
275
same option. There cannot be whitespace before or after the \ ``=``\ and
276
if the value contains whitespace it must be quoted. DSN options are
277
comma-separated. See the percona-toolkit manpage for full details.
282
dsn: charset; copy: yes
284
Default character set.
290
dsn: database; copy: yes
298
dsn: mysql_read_default_file; copy: yes
300
Only read default options from the given file
314
dsn: password; copy: yes
316
Password to use when connecting.
324
Port number to use for connection.
330
dsn: mysql_socket; copy: yes
332
Socket file to use for connection.
338
Table in which to store foreign key errors.
346
User for login if not current user.
356
The environment variable \ ``PTDEBUG``\ enables verbose debugging output to STDERR.
357
To enable debugging and capture all output to a file, run the tool like:
362
PTDEBUG=1 pt-fk-error-logger ... > FILE 2>&1
365
Be careful: debugging output is voluminous and can generate several megabytes
374
You need Perl, DBI, DBD::mysql, and some core packages that ought to be
375
installed in any reasonably new version of Perl.
383
For a list of known bugs, see `http://www.percona.com/bugs/pt-fk-error-logger <http://www.percona.com/bugs/pt-fk-error-logger>`_.
385
Please report bugs at `https://bugs.launchpad.net/percona-toolkit <https://bugs.launchpad.net/percona-toolkit>`_.
386
Include the following information in your bug report:
389
\* Complete command-line used to run the tool
397
\* MySQL version of all servers involved
401
\* Output from the tool including STDERR
405
\* Input files (log/dump/config files, etc.)
409
If possible, include debugging output by running the tool with \ ``PTDEBUG``\ ;
418
Visit `http://www.percona.com/software/percona-toolkit/ <http://www.percona.com/software/percona-toolkit/>`_ to download the
419
latest release of Percona Toolkit. Or, get the latest release from the
425
wget percona.com/get/percona-toolkit.tar.gz
427
wget percona.com/get/percona-toolkit.rpm
429
wget percona.com/get/percona-toolkit.deb
432
You can also get individual tools from the latest release:
437
wget percona.com/get/TOOL
440
Replace \ ``TOOL``\ with the name of any tool.
451
*********************
452
ABOUT PERCONA TOOLKIT
453
*********************
456
This tool is part of Percona Toolkit, a collection of advanced command-line
457
tools developed by Percona for MySQL support and consulting. Percona Toolkit
458
was forked from two projects in June, 2011: Maatkit and Aspersa. Those
459
projects were created by Baron Schwartz and developed primarily by him and
460
Daniel Nichter, both of whom are employed by Percona. Visit
461
`http://www.percona.com/software/ <http://www.percona.com/software/>`_ for more software developed by Percona.
464
********************************
465
COPYRIGHT, LICENSE, AND WARRANTY
466
********************************
469
This program is copyright 2011 Percona Inc.
470
Feedback and improvements are welcome.
472
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
473
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
474
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
476
This program is free software; you can redistribute it and/or modify it under
477
the terms of the GNU General Public License as published by the Free Software
478
Foundation, version 2; OR the Perl Artistic License. On UNIX and similar
479
systems, you can issue \`man perlgpl' or \`man perlartistic' to read these
482
You should have received a copy of the GNU General Public License along with
483
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
484
Place, Suite 330, Boston, MA 02111-1307 USA.
492
Percona Toolkit v0.9.5 released 2011-08-04