~percona-toolkit-dev/percona-toolkit/1.0

« back to all changes in this revision

Viewing changes to docs/user/pt-fk-error-logger.rst

  • Committer: Daniel Nichter
  • Date: 2011-12-29 22:16:13 UTC
  • Revision ID: daniel@percona.com-20111229221613-oprw0q2td34r6zkb
Update release date.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
##################
3
 
pt-fk-error-logger
4
 
##################
5
 
 
6
 
.. highlight:: perl
7
 
 
8
 
 
9
 
****
10
 
NAME
11
 
****
12
 
 
13
 
 
14
 
pt-fk-error-logger - Extract and log MySQL foreign key errors.
15
 
 
16
 
 
17
 
********
18
 
SYNOPSIS
19
 
********
20
 
 
21
 
 
22
 
Usage: pt-fk-error-logger [OPTION...] SOURCE_DSN
23
 
 
24
 
pt-fk-error-logger extracts and saves information about the most recent foreign
25
 
key errors in a MySQL server.
26
 
 
27
 
Print foreign key errors on host1:
28
 
 
29
 
 
30
 
.. code-block:: perl
31
 
 
32
 
    pt-fk-error-logger h=host1
33
 
 
34
 
 
35
 
Save foreign key errors on host1 to db.foreign_key_errors table on host2:
36
 
 
37
 
 
38
 
.. code-block:: perl
39
 
 
40
 
   pt-fk-error-logger h=host1 --dest h=host1,D=db,t=foreign_key_errors
41
 
 
42
 
 
43
 
 
44
 
*****
45
 
RISKS
46
 
*****
47
 
 
48
 
 
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.
53
 
 
54
 
pt-fk-error-logger is read-only unless you specify "--dest".  It should be
55
 
very low-risk.
56
 
 
57
 
At the time of this release, we know of no bugs that could cause serious harm to
58
 
users.
59
 
 
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>`_.
64
 
 
65
 
See also "BUGS" for more information on filing bugs and getting help.
66
 
 
67
 
 
68
 
***********
69
 
DESCRIPTION
70
 
***********
71
 
 
72
 
 
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.
77
 
 
78
 
 
79
 
******
80
 
OUTPUT
81
 
******
82
 
 
83
 
 
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``\ .
87
 
 
88
 
 
89
 
*******
90
 
OPTIONS
91
 
*******
92
 
 
93
 
 
94
 
This tool accepts additional command-line arguments.  Refer to the
95
 
"SYNOPSIS" and usage information for details.
96
 
 
97
 
 
98
 
--ask-pass
99
 
 
100
 
 Prompt for a password when connecting to MySQL.
101
 
 
102
 
 
103
 
 
104
 
--charset
105
 
 
106
 
 short form: -A; type: string
107
 
 
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.
112
 
 
113
 
 
114
 
 
115
 
--config
116
 
 
117
 
 type: Array
118
 
 
119
 
 Read this comma-separated list of config files; if specified, this must be the
120
 
 first option on the command line.
121
 
 
122
 
 
123
 
 
124
 
--daemonize
125
 
 
126
 
 Fork to the background and detach from the shell.  POSIX operating systems only.
127
 
 
128
 
 
129
 
 
130
 
--defaults-file
131
 
 
132
 
 short form: -F; type: string
133
 
 
134
 
 Only read mysql options from the given file.  You must give an absolute
135
 
 pathname.
136
 
 
137
 
 
138
 
 
139
 
--dest
140
 
 
141
 
 type: DSN
142
 
 
143
 
 DSN for where to store foreign key errors; specify at least a database (D) and table (t).
144
 
 
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.
148
 
 
149
 
 The following table is suggested:
150
 
 
151
 
 
152
 
 .. code-block:: perl
153
 
 
154
 
   CREATE TABLE foreign_key_errors (
155
 
     ts datetime NOT NULL,
156
 
     error text NOT NULL,
157
 
     PRIMARY KEY (ts),
158
 
   )
159
 
 
160
 
 
161
 
 The only information saved is the timestamp and the foreign key error text.
162
 
 
163
 
 
164
 
 
165
 
--help
166
 
 
167
 
 Show help and exit.
168
 
 
169
 
 
170
 
 
171
 
--host
172
 
 
173
 
 short form: -h; type: string
174
 
 
175
 
 Connect to host.
176
 
 
177
 
 
178
 
 
179
 
--interval
180
 
 
181
 
 type: time; default: 0
182
 
 
183
 
 How often to check for foreign key errors.
184
 
 
185
 
 
186
 
 
187
 
--log
188
 
 
189
 
 type: string
190
 
 
191
 
 Print all output to this file when daemonized.
192
 
 
193
 
 
194
 
 
195
 
--password
196
 
 
197
 
 short form: -p; type: string
198
 
 
199
 
 Password to use when connecting.
200
 
 
201
 
 
202
 
 
203
 
--pid
204
 
 
205
 
 type: string
206
 
 
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.
211
 
 
212
 
 
213
 
 
214
 
--port
215
 
 
216
 
 short form: -P; type: int
217
 
 
218
 
 Port number to use for connection.
219
 
 
220
 
 
221
 
 
222
 
--print
223
 
 
224
 
 Print results on standard output.  See "OUTPUT" for more.
225
 
 
226
 
 
227
 
 
228
 
--run-time
229
 
 
230
 
 type: time
231
 
 
232
 
 How long to run before exiting.
233
 
 
234
 
 
235
 
 
236
 
--set-vars
237
 
 
238
 
 type: string; default: wait_timeout=10000
239
 
 
240
 
 Set these MySQL variables.  Immediately after connecting to MySQL, this string
241
 
 will be appended to SET and executed.
242
 
 
243
 
 
244
 
 
245
 
--socket
246
 
 
247
 
 short form: -S; type: string
248
 
 
249
 
 Socket file to use for connection.
250
 
 
251
 
 
252
 
 
253
 
--user
254
 
 
255
 
 short form: -u; type: string
256
 
 
257
 
 User for login if not current user.
258
 
 
259
 
 
260
 
 
261
 
--version
262
 
 
263
 
 Show version and exit.
264
 
 
265
 
 
266
 
 
267
 
 
268
 
***********
269
 
DSN OPTIONS
270
 
***********
271
 
 
272
 
 
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.
278
 
 
279
 
 
280
 
\* A
281
 
 
282
 
 dsn: charset; copy: yes
283
 
 
284
 
 Default character set.
285
 
 
286
 
 
287
 
 
288
 
\* D
289
 
 
290
 
 dsn: database; copy: yes
291
 
 
292
 
 Default database.
293
 
 
294
 
 
295
 
 
296
 
\* F
297
 
 
298
 
 dsn: mysql_read_default_file; copy: yes
299
 
 
300
 
 Only read default options from the given file
301
 
 
302
 
 
303
 
 
304
 
\* h
305
 
 
306
 
 dsn: host; copy: yes
307
 
 
308
 
 Connect to host.
309
 
 
310
 
 
311
 
 
312
 
\* p
313
 
 
314
 
 dsn: password; copy: yes
315
 
 
316
 
 Password to use when connecting.
317
 
 
318
 
 
319
 
 
320
 
\* P
321
 
 
322
 
 dsn: port; copy: yes
323
 
 
324
 
 Port number to use for connection.
325
 
 
326
 
 
327
 
 
328
 
\* S
329
 
 
330
 
 dsn: mysql_socket; copy: yes
331
 
 
332
 
 Socket file to use for connection.
333
 
 
334
 
 
335
 
 
336
 
\* t
337
 
 
338
 
 Table in which to store foreign key errors.
339
 
 
340
 
 
341
 
 
342
 
\* u
343
 
 
344
 
 dsn: user; copy: yes
345
 
 
346
 
 User for login if not current user.
347
 
 
348
 
 
349
 
 
350
 
 
351
 
***********
352
 
ENVIRONMENT
353
 
***********
354
 
 
355
 
 
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:
358
 
 
359
 
 
360
 
.. code-block:: perl
361
 
 
362
 
    PTDEBUG=1 pt-fk-error-logger ... > FILE 2>&1
363
 
 
364
 
 
365
 
Be careful: debugging output is voluminous and can generate several megabytes
366
 
of output.
367
 
 
368
 
 
369
 
*******************
370
 
SYSTEM REQUIREMENTS
371
 
*******************
372
 
 
373
 
 
374
 
You need Perl, DBI, DBD::mysql, and some core packages that ought to be
375
 
installed in any reasonably new version of Perl.
376
 
 
377
 
 
378
 
****
379
 
BUGS
380
 
****
381
 
 
382
 
 
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>`_.
384
 
 
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:
387
 
 
388
 
 
389
 
\* Complete command-line used to run the tool
390
 
 
391
 
 
392
 
 
393
 
\* Tool "--version"
394
 
 
395
 
 
396
 
 
397
 
\* MySQL version of all servers involved
398
 
 
399
 
 
400
 
 
401
 
\* Output from the tool including STDERR
402
 
 
403
 
 
404
 
 
405
 
\* Input files (log/dump/config files, etc.)
406
 
 
407
 
 
408
 
 
409
 
If possible, include debugging output by running the tool with \ ``PTDEBUG``\ ;
410
 
see "ENVIRONMENT".
411
 
 
412
 
 
413
 
***********
414
 
DOWNLOADING
415
 
***********
416
 
 
417
 
 
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
420
 
command line:
421
 
 
422
 
 
423
 
.. code-block:: perl
424
 
 
425
 
    wget percona.com/get/percona-toolkit.tar.gz
426
 
 
427
 
    wget percona.com/get/percona-toolkit.rpm
428
 
 
429
 
    wget percona.com/get/percona-toolkit.deb
430
 
 
431
 
 
432
 
You can also get individual tools from the latest release:
433
 
 
434
 
 
435
 
.. code-block:: perl
436
 
 
437
 
    wget percona.com/get/TOOL
438
 
 
439
 
 
440
 
Replace \ ``TOOL``\  with the name of any tool.
441
 
 
442
 
 
443
 
*******
444
 
AUTHORS
445
 
*******
446
 
 
447
 
 
448
 
Daniel Nichter
449
 
 
450
 
 
451
 
*********************
452
 
ABOUT PERCONA TOOLKIT
453
 
*********************
454
 
 
455
 
 
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.
462
 
 
463
 
 
464
 
********************************
465
 
COPYRIGHT, LICENSE, AND WARRANTY
466
 
********************************
467
 
 
468
 
 
469
 
This program is copyright 2011 Percona Inc.
470
 
Feedback and improvements are welcome.
471
 
 
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.
475
 
 
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
480
 
licenses.
481
 
 
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.
485
 
 
486
 
 
487
 
*******
488
 
VERSION
489
 
*******
490
 
 
491
 
 
492
 
pt-fk-error-logger 1.0.2
493