pt-slave-delay starts and stops a slave server as needed to make it lag
behind the master. The SLAVE-HOST and MASTER-HOST use DSN syntax, and
values are copied from the SLAVE-HOST to the MASTER-HOST if omitted.

The following section is included to inform users about the potential risks,
whether known or unknown, of using this tool. The two main categories of risks
are those created by the nature of the tool (e.g. read-only tools vs. read-write
tools) and those created by bugs.

pt-slave-delay is generally very low-risk. It simply starts and stops the
replication SQL thread. This might cause monitoring systems to think the slave
is having trouble.

At the time of this release, we know of no bugs that could cause serious harm to
users.

The authoritative source for updated information is always the online issue
tracking system. Issues that affect this tool will be marked as such. You can
see a list of such issues at the following URL:
http://www.percona.com/bugs/pt-slave-delay.

pt-slave-delay watches a slave and starts and stops its replication SQL
thread as necessary to hold it at least as far behind the master as you
request. In practice, it will typically cause the slave to lag between
--delay and --delay"+"--interval behind the master.

It bases the delay on binlog positions in the slave’s relay logs by default,
so there is no need to connect to the master. This works well if the IO
thread doesn’t lag the master much, which is typical in most replication
setups; the IO thread lag is usually milliseconds on a fast network. If your
IO thread’s lag is too large for your purposes, pt-slave-delay can also
connect to the master for information about binlog positions.

If the slave’s I/O thread reports that it is waiting for the SQL thread to
free some relay log space, pt-slave-delay will automatically connect to the
master to find binary log positions. If --ask-pass and --daemonize
are given, it is possible that this could cause it to ask for a password while
daemonized. In this case, it exits. Therefore, if you think your slave might
encounter this condition, you should be sure to either specify
--use-master explicitly when daemonizing, or don’t specify --ask-pass.

The SLAVE-HOST and optional MASTER-HOST are both DSNs. See “DSN OPTIONS”.
Missing MASTER-HOST values are filled in with values from SLAVE-HOST, so you
don’t need to specify them in both places. pt-slave-delay reads all normal
MySQL option files, such as ~/.my.cnf, so you may not need to specify username,
password and other common options at all.

pt-slave-delay tries to exit gracefully by trapping signals such as Ctrl-C.
You cannot bypass --[no]continue with a trappable signal.

If you specify --quiet, there is no output. Otherwise, the normal output
is a status message consisting of a timestamp and information about what
pt-slave-delay is doing: starting the slave, stopping the slave, or just
observing.

Default character set. 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.

Continue replication normally on exit. After exiting, restart the slave’s SQL
thread with no UNTIL condition, so it will run as usual and catch up to the
master. This is enabled by default and works even if you terminate
pt-slave-delay with Control-C.

Create the given PID file when daemonized. The file contains the process
ID of the daemonized instance. The PID file is removed when the
daemonized instance exits. The program checks for the existence of the
PID file when starting; if it exists and the process with the matching PID
exists, the program exits.

Get binlog positions from master, not slave. Don’t trust the binlog positions
in the slave’s relay log. Connect to the master and get binlog positions
instead. If you specify this option without giving a MASTER-HOST on the command
line, pt-slave-delay examines the slave’s SHOW SLAVE STATUS to determine the
hostname and port for connecting to the master.

pt-slave-delay uses only the MASTER_HOST and MASTER_PORT values from SHOW
SLAVE STATUS for the master connection. It does not use the MASTER_USER
value. If you want to specify a different username for the master than the
one you use to connect to the slave, you should specify the MASTER-HOST option
explicitly on the command line.

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. 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 percona-toolkit manpage for full details.

This tool is part of Percona Toolkit, a collection of advanced command-line
tools developed by Percona for MySQL support and consulting. Percona Toolkit
was forked from two projects in June, 2011: Maatkit and Aspersa. Those
projects were created by Baron Schwartz and developed primarily by him and
Daniel Nichter, both of whom are employed by Percona. Visit
http://www.percona.com/software/ for more software developed by Percona.

This program is copyright 2007-2011 Sergey Zhuravle and Baron Schwartz,
2011-2012 Percona Inc.
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.