1MK-SLAVE-DELAY(1)     User Contributed Perl Documentation    MK-SLAVE-DELAY(1)
2
3
4

NAME

6       mk-slave-delay - Make a MySQL slave server lag behind its master.
7

SYNOPSIS

9       To hold slavehost one minute behind its master for ten minutes:
10
11          mk-slave-delay --delay 1m --interval 15s --run-time 10m slavehost
12

RISKS

14       The following section is included to inform users about the potential
15       risks, whether known or unknown, of using this tool.  The two main
16       categories of risks are those created by the nature of the tool (e.g.
17       read-only tools vs. read-write tools) and those created by bugs.
18
19       mk-slave-delay is generally very low-risk.  It simply starts and stops
20       the replication SQL thread.  This might cause monitoring systems to
21       think the slave is having trouble.
22
23       At the time of this release, mk-slave-delay does not reconnect to the
24       server if the connection is lost.
25
26       The authoritative source for updated information is always the online
27       issue tracking system.  Issues that affect this tool will be marked as
28       such.  You can see a list of such issues at the following URL:
29       http://www.maatkit.org/bugs/mk-slave-delay
30       <http://www.maatkit.org/bugs/mk-slave-delay>.
31
32       See also "BUGS" for more information on filing bugs and getting help.
33

DESCRIPTION

35       "mk-slave-delay" watches a slave and starts and stops its replication
36       SQL thread as necessary to hold it at least as far behind the master as
37       you request.  In practice, it will typically cause the slave to lag
38       between "--delay" and "--delay"+"--interval" behind the master.
39
40       It bases the delay on binlog positions in the slave's relay logs by
41       default, so there is no need to connect to the master.  This works well
42       if the IO thread doesn't lag the master much, which is typical in most
43       replication setups; the IO thread lag is usually milliseconds on a fast
44       network.  If your IO thread's lag is too large for your purposes,
45       "mk-slave-delay" can also connect to the master for information about
46       binlog positions.
47
48       If the slave's I/O thread reports that it is waiting for the SQL thread
49       to free some relay log space, "mk-slave-delay" will automatically
50       connect to the master to find binary log positions.  If "--ask-pass"
51       and "--daemonize" are given, it is possible that this could cause it to
52       ask for a password while daemonized.  In this case, it exits.
53       Therefore, if you think your slave might encounter this condition, you
54       should be sure to either specify "--use-master" explicitly when
55       daemonizing, or don't specify "--ask-pass".
56
57       The SLAVE-HOST and optional MASTER-HOST are both DSNs.  See "DSN
58       OPTIONS".  Missing MASTER-HOST values are filled in with values from
59       SLAVE-HOST, so you don't need to specify them in both places.
60       "mk-slave-delay" reads all normal MySQL option files, such as
61       ~/.my.cnf, so you may not need to specify username, password and other
62       common options at all.
63
64       "mk-slave-delay" tries to exit gracefully by trapping signals such as
65       Ctrl-C.  You cannot bypass "--[no]continue" with a trappable signal.
66

PRIVILEGES

68       mk-slave-delay requires the following privileges: PROCESS, REPLICATION
69       CLIENT, and SUPER.
70

OUTPUT

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

OPTIONS

78       --ask-pass
79           Prompt for a password when connecting to MySQL.
80
81       --charset
82           short form: -A; type: string
83
84           Default character set.  If the value is utf8, sets Perl's binmode
85           on STDOUT to utf8, passes the mysql_enable_utf8 option to
86           DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL.  Any
87           other value sets binmode on STDOUT without the utf8 layer, and runs
88           SET NAMES after connecting to MySQL.
89
90       --config
91           type: Array
92
93           Read this comma-separated list of config files; if specified, this
94           must be the first option on the command line.
95
96       --[no]continue
97           default: yes
98
99           Continue replication normally on exit.  After exiting, restart the
100           slave's SQL thread with no UNTIL condition, so it will run as usual
101           and catch up to the master.  This is enabled by default and works
102           even if you terminate "mk-slave-delay" with Control-C.
103
104       --daemonize
105           Fork to the background and detach from the shell.  POSIX operating
106           systems only.
107
108       --defaults-file
109           short form: -F; type: string
110
111           Only read mysql options from the given file.  You must give an
112           absolute pathname.
113
114       --delay
115           type: time; default: 1h
116
117           How far the slave should lag its master.
118
119       --help
120           Show help and exit.
121
122       --host
123           short form: -h; type: string
124
125           Connect to host.
126
127       --interval
128           type: time; default: 1m
129
130           How frequently "mk-slave-delay" should check whether the slave
131           needs to be started or stopped.
132
133       --log
134           type: string
135
136           Print all output to this file when daemonized.
137
138       --password
139           short form: -p; type: string
140
141           Password to use when connecting.
142
143       --pid
144           type: string
145
146           Create the given PID file when daemonized.  The file contains the
147           process ID of the daemonized instance.  The PID file is removed
148           when the daemonized instance exits.  The program checks for the
149           existence of the PID file when starting; if it exists and the
150           process with the matching PID exists, the program exits.
151
152       --port
153           short form: -P; type: int
154
155           Port number to use for connection.
156
157       --quiet
158           short form: -q
159
160           Don't print informational messages about operation.  See OUTPUT for
161           details.
162
163       --run-time
164           type: time
165
166           How long "mk-slave-delay" should run before exiting.  The default
167           is to run forever.
168
169       --set-vars
170           type: string; default: wait_timeout=10000
171
172           Set these MySQL variables.  Immediately after connecting to MySQL,
173           this string will be appended to SET and executed.
174
175       --socket
176           short form: -S; type: string
177
178           Socket file to use for connection.
179
180       --use-master
181           Get binlog positions from master, not slave.  Don't trust the
182           binlog positions in the slave's relay log.  Connect to the master
183           and get binlog positions instead.  If you specify this option
184           without giving a MASTER-HOST on the command line, "mk-slave-delay"
185           examines the slave's SHOW SLAVE STATUS to determine the hostname
186           and port for connecting to the master.
187
188           "mk-slave-delay" uses only the MASTER_HOST and MASTER_PORT values
189           from SHOW SLAVE STATUS for the master connection.  It does not use
190           the MASTER_USER value.  If you want to specify a different username
191           for the master than the one you use to connect to the slave, you
192           should specify the MASTER-HOST option explicitly on the command
193           line.
194
195       --user
196           short form: -u; type: string
197
198           User for login if not current user.
199
200       --version
201           Show version and exit.
202

DSN OPTIONS

204       These DSN options are used to create a DSN.  Each option is given like
205       "option=value".  The options are case-sensitive, so P and p are not the
206       same option.  There cannot be whitespace before or after the "=" and if
207       the value contains whitespace it must be quoted.  DSN options are
208       comma-separated.  See the maatkit manpage for full details.
209
210       ·   A
211
212           dsn: charset; copy: yes
213
214           Default character set.
215
216       ·   D
217
218           dsn: database; copy: yes
219
220           Default database.
221
222       ·   F
223
224           dsn: mysql_read_default_file; copy: yes
225
226           Only read default options from the given file
227
228       ·   h
229
230           dsn: host; copy: yes
231
232           Connect to host.
233
234       ·   p
235
236           dsn: password; copy: yes
237
238           Password to use when connecting.
239
240       ·   P
241
242           dsn: port; copy: yes
243
244           Port number to use for connection.
245
246       ·   S
247
248           dsn: mysql_socket; copy: yes
249
250           Socket file to use for connection.
251
252       ·   u
253
254           dsn: user; copy: yes
255
256           User for login if not current user.
257

DOWNLOADING

259       You can download Maatkit from Google Code at
260       <http://code.google.com/p/maatkit/>, or you can get any of the tools
261       easily with a command like the following:
262
263          wget http://www.maatkit.org/get/toolname
264          or
265          wget http://www.maatkit.org/trunk/toolname
266
267       Where "toolname" can be replaced with the name (or fragment of a name)
268       of any of the Maatkit tools.  Once downloaded, they're ready to run; no
269       installation is needed.  The first URL gets the latest released version
270       of the tool, and the second gets the latest trunk code from Subversion.
271

ENVIRONMENT

273       The environment variable "MKDEBUG" enables verbose debugging output in
274       all of the Maatkit tools:
275
276          MKDEBUG=1 mk-....
277

SYSTEM REQUIREMENTS

279       You need Perl, DBI, DBD::mysql, and some core packages that ought to be
280       installed in any reasonably new version of Perl.
281

BUGS

283       For list of known bugs see http://www.maatkit.org/bugs/mk-slave-delay
284       <http://www.maatkit.org/bugs/mk-slave-delay>.
285
286       Please use Google Code Issues and Groups to report bugs or request
287       support: <http://code.google.com/p/maatkit/>.  You can also join
288       #maatkit on Freenode to discuss Maatkit.
289
290       Please include the complete command-line used to reproduce the problem
291       you are seeing, the version of all MySQL servers involved, the complete
292       output of the tool when run with "--version", and if possible,
293       debugging output produced by running with the "MKDEBUG=1" environment
294       variable.
295

COPYRIGHT, LICENSE AND WARRANTY

297       This program is copyright 2007-2010 Sergey Zhuravlev and Baron
298       Schwartz.  Feedback and improvements are welcome.
299
300       THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
301       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
302       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
303
304       This program is free software; you can redistribute it and/or modify it
305       under the terms of the GNU General Public License as published by the
306       Free Software Foundation, version 2; OR the Perl Artistic License.  On
307       UNIX and similar systems, you can issue `man perlgpl' or `man
308       perlartistic' to read these licenses.
309
310       You should have received a copy of the GNU General Public License along
311       with this program; if not, write to the Free Software Foundation, Inc.,
312       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
313

AUTHOR

315       Sergey Zhuravlev, Baron Schwartz
316

ABOUT MAATKIT

318       This tool is part of Maatkit, a toolkit for power users of MySQL.
319       Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the
320       primary code contributors.  Both are employed by Percona.  Financial
321       support for Maatkit development is primarily provided by Percona and
322       its clients.
323

VERSION

325       This manual page documents Ver 1.0.22 Distrib 6839 $Revision: 6835 $.
326
327
328
329perl v5.12.1                      2010-08-01                 MK-SLAVE-DELAY(1)
Impressum