.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MYSQL-SLAVE-RESTART 1" .TH MYSQL-SLAVE-RESTART 1 "2007-10-15" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" mysql\-slave\-restart \- Watch and restart MySQL replication after errors. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& mysql-slave-restart --verbose .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" MySQL Slave Restart watches a MySQL replication slave and tries to skip statements that cause errors. It polls the slave intelligently with an exponentially varying sleep time. You can specify errors to skip and run the slave until a certain binlog position. .PP Note: it has come to my attention that Yahoo! had or has an internal tool called fix_repl, described to me by a past Yahoo! employee and mentioned in the first edition of High Performance MySQL. Apparently this tool does the same thing. Make no mistake, though: this is not a way to \*(L"fix replication.\*(R" In fact I would not even encourage its use on a regular basis; I only use it when I have an error I know I just need to skip past. .PP Indiscriminate use of this tool can easily screw up a server you might have had a chance to truly fix. You have been warned. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\-\-askpass" 4 .IX Item "--askpass" Prompt for a password for the connection. .IP "\-\-daemonize" 4 .IX Item "--daemonize" Fork to the background and detach from the shell. This probably doesn't work on Microsoft Windows. .IP "\-\-database" 4 .IX Item "--database" Database to use. .IP "\-\-defaults\-file" 4 .IX Item "--defaults-file" Only read default options from the given file. .IP "\-\-error\-numbers" 4 .IX Item "--error-numbers" Makes MySQL Slave Restart only try to restart if the error number is in this comma-separated list of errors. If it sees an error not in the list, it will exit. .Sp The error number is in the last_errno column of \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0. .IP "\-\-error\-text" 4 .IX Item "--error-text" A Perl regular expression against which the error text, if any, is matched. If the error text exists and matches, MySQL Slave Restart will try to restart the slave. If it exists but doesn't match, MySQL Slave Restart will exit. .Sp The error text is in the last_error column of \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0. .IP "\-\-error\-length" 4 .IX Item "--error-length" When \*(L"\-\-verbose\*(R" is set high enough to print the error, this option will truncate the error text to the specified length. This can be useful to prevent wrapping on the terminal. .IP "\-\-help" 4 .IX Item "--help" Show a brief help message and exit. .IP "\-\-host" 4 .IX Item "--host" Connect to host. .IP "\-\-maxsleep" 4 .IX Item "--maxsleep" The maximum time MySQL Slave Restart will sleep before polling the slave again. See \*(L"\s-1SLEEP\s0\*(R". .IP "\-\-minsleep" 4 .IX Item "--minsleep" The minimum time MySQL Slave Restart will sleep before polling the slave again. See \*(L"\s-1SLEEP\s0\*(R". .IP "\-\-password" 4 .IX Item "--password" Password to use when connecting. .IP "\-\-port" 4 .IX Item "--port" Port number to use for connection. .IP "\-\-skipcount" 4 .IX Item "--skipcount" The number of statements to skip when restarting the slave. .IP "\-\-sleep" 4 .IX Item "--sleep" The initial sleep time between checking the slave. See \*(L"\s-1SLEEP\s0\*(R". .IP "\-\-socket" 4 .IX Item "--socket" Socket file to use for connection. .IP "\-\-time" 4 .IX Item "--time" Causes MySQL Slave Restart to stop after the specified time has elapsed. The argument can have a suffix of s, m, h, or d, indicating seconds, minutes, hours, or days. The number is interpreted as seconds if there is no suffix. .IP "\-\-untilmaster" 4 .IX Item "--untilmaster" Start the slave, and retry if it fails, until it reaches the given replication coordinates. The coordinates are the logfile and position on the master, given by relay_master_log_file, exec_master_log_pos. The argument must be in the format \*(L"file,pos\*(R". Separate the filename and position with a single comma and no space. .Sp This will also cause an \s-1UNTIL\s0 clause to be given to \s-1START\s0 \s-1SLAVE\s0. .Sp After reaching this point, the slave should be stopped and MySQL Slave Restart will exit. .IP "\-\-untilrelay" 4 .IX Item "--untilrelay" Like \*(L"\-\-untilmaster\*(R", but in the slave's relay logs instead. The coordinates are given by relay_log_file, relay_log_pos. .IP "\-\-user" 4 .IX Item "--user" User for login if not current user. .IP "\-\-verbose" 4 .IX Item "--verbose" Verbosity; specify multiple times for more verbosity. Default is no output. Verbosity 1 outputs a timestamp, relay_log_file, relay_log_pos, and last_errno. Verbosity 2 adds last_error. See also \*(L"\-\-error\-length\*(R". Verbosity 3 prints the current sleep time each time MySQL Slave Restart sleeps. .IP "\-\-version" 4 .IX Item "--version" Output version information and exit. .SH "SYSTEM REQUIREMENTS" .IX Header "SYSTEM REQUIREMENTS" You need Perl, \s-1DBI\s0, DBD::mysql, and some core packages that ought to be installed in any reasonably new version of Perl. .SH "OUTPUT" .IX Header "OUTPUT" If you specify \-\-verbose, MySQL Slave Restart prints a line every time it sees the slave has an error. See \*(L"\-\-verbose\*(R" for details. .SH "SLEEP" .IX Header "SLEEP" MySQL Slave Restart sleeps intelligently between polling the slave. The current sleep time varies. .IP "\(bu" 4 The initial sleep time is given by \*(L"\-\-sleep\*(R". .IP "\(bu" 4 If it checks and finds an error, it halves the previous sleep time. .IP "\(bu" 4 If it finds no error, it doubles the previous sleep time. .IP "\(bu" 4 The sleep time is bounded below by \*(L"\-\-minsleep\*(R" and above by \*(L"\-\-maxsleep\*(R". .IP "\(bu" 4 Immediately after finding an error, MySQL Slave Restart assumes another error is very likely to happen next, so it sleeps the current sleep time or the initial sleep time, whichever is less. .SH "COMPATIBILITY" .IX Header "COMPATIBILITY" MySQL Slave Restart should work on many versions of MySQL. Lettercase of many output columns from \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0 has changed over time, so it treats them all as lowercase. .SH "BUGS" .IX Header "BUGS" If you find bugs, need features, etc please use the bug tracker, forums, and mailing lists at http://sourceforge.net/projects/mysqltoolkit. .SH "SEE ALSO" .IX Header "SEE ALSO" See also mysql-table-checksum, mysql-table-sync, mysql-slave-delay. .SH "COPYRIGHT, LICENSE AND WARRANTY" .IX Header "COPYRIGHT, LICENSE AND WARRANTY" This program is copyright (c) 2007 Baron Schwartz. Feedback and improvements are welcome. .PP \&\s-1THIS\s0 \s-1PROGRAM\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \&\s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation, version 2; \s-1OR\s0 the Perl Artistic License. On \s-1UNIX\s0 and similar systems, you can issue `man perlgpl' or `man perlartistic' to read these licenses. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0. .SH "AUTHOR" .IX Header "AUTHOR" Baron Schwartz .SH "VERSION" .IX Header "VERSION" This manual page documents Ver 1.0.1 Distrib 1053 \f(CW$Revision:\fR 863 $.