1MK-SLAVE-FIND(1) User Contributed Perl Documentation MK-SLAVE-FIND(1)
2
3
4
6 mk-slave-find - Find and print replication hierarchy tree of MySQL
7 slaves.
8
10 Usage: mk-slave-find [OPTION...] MASTER-HOST
11
12 mk-slave-find finds and prints a hierarchy tree of MySQL slaves.
13
14 Examples:
15
16 mk-slave-find --host master-host
17
19 The following section is included to inform users about the potential
20 risks, whether known or unknown, of using this tool. The two main
21 categories of risks are those created by the nature of the tool (e.g.
22 read-only tools vs. read-write tools) and those created by bugs.
23
24 mk-slave-find is read-only and very low-risk.
25
26 At the time of this release, we know of no bugs that could cause
27 serious harm to users.
28
29 The authoritative source for updated information is always the online
30 issue tracking system. Issues that affect this tool will be marked as
31 such. You can see a list of such issues at the following URL:
32 <http://www.maatkit.org/bugs/mk-slave-find>.
33
34 See also "BUGS" for more information on filing bugs and getting help.
35
37 mk-slave-find connects to a MySQL replication master and finds its
38 slaves. Currently the only thing it can do is print a tree-like view
39 of the replication hierarchy.
40
41 The master host can be specified using one of two methods. The first
42 method is to use the standard connection-related command line options:
43 "--defaults-file", "--password", "--host", "--port", "--socket" or
44 "--user".
45
46 The second method to specify the master host is a DSN. A DSN is a
47 special syntax that can be either just a hostname (like
48 "server.domain.com" or 1.2.3.4), or a "key=value,key=value" string.
49 Keys are a single letter:
50
51 KEY MEANING
52 === =======
53 h Connect to host
54 P Port number to use for connection
55 S Socket file to use for connection
56 u User for login if not current user
57 p Password to use when connecting
58 F Only read default options from the given file
59
60 "mk-slave-find" reads all normal MySQL option files, such as ~/.my.cnf,
61 so you may not need to specify username, password and other common
62 options at all.
63
65 An exit status of 0 (sometimes also called a return value or return
66 code) indicates success. Any other value represents the exit status of
67 the Perl process itself.
68
70 This tool accepts additional command-line arguments. Refer to the
71 "SYNOPSIS" and usage information for details.
72
73 --ask-pass
74 Prompt for a password when connecting to MySQL.
75
76 --charset
77 short form: -A; type: string
78
79 Default character set. If the value is utf8, sets Perl's binmode
80 on STDOUT to utf8, passes the mysql_enable_utf8 option to
81 DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL. Any
82 other value sets binmode on STDOUT without the utf8 layer, and runs
83 SET NAMES after connecting to MySQL.
84
85 --config
86 type: Array
87
88 Read this comma-separated list of config files; if specified, this
89 must be the first option on the command line.
90
91 --database
92 type: string; short form: -D
93
94 Database to use.
95
96 --defaults-file
97 short form: -F; type: string
98
99 Only read mysql options from the given file. You must give an
100 absolute pathname.
101
102 --help
103 Show help and exit.
104
105 --host
106 short form: -h; type: string
107
108 Connect to host.
109
110 --password
111 short form: -p; type: string
112
113 Password to use when connecting.
114
115 --pid
116 type: string
117
118 Create the given PID file. The file contains the process ID of the
119 script. The PID file is removed when the script exits. Before
120 starting, the script checks if the PID file already exists. If it
121 does not, then the script creates and writes its own PID to it. If
122 it does, then the script checks the following: if the file contains
123 a PID and a process is running with that PID, then the script dies;
124 or, if there is no process running with that PID, then the script
125 overwrites the file with its own PID and starts; else, if the file
126 contains no PID, then the script dies.
127
128 --port
129 short form: -P; type: int
130
131 Port number to use for connection.
132
133 --recurse
134 type: int
135
136 Number of levels to recurse in the hierarchy. Default is infinite.
137
138 See "--recursion-method".
139
140 --recursion-method
141 type: string
142
143 Preferred recursion method used to find slaves.
144
145 Possible methods are:
146
147 METHOD USES
148 =========== ================
149 processlist SHOW PROCESSLIST
150 hosts SHOW SLAVE HOSTS
151
152 The processlist method is preferred because SHOW SLAVE HOSTS is not
153 reliable. However, the hosts method is required if the server uses
154 a non-standard port (not 3306). Usually mk-slave-find does the
155 right thing and finds the slaves, but you may give a preferred
156 method and it will be used first. If it doesn't find any slaves,
157 the other methods will be tried.
158
159 --report-format
160 type: string; default: summary
161
162 Set what information about the slaves is printed. The report
163 format can be one of the following:
164
165 · hostname
166
167 Print just the hostname name of the slaves. It looks like:
168
169 127.0.0.1:12345
170 +- 127.0.0.1:12346
171 +- 127.0.0.1:12347
172
173 · summary
174
175 Print a summary of each slave's settings. This report shows
176 more information about each slave, like:
177
178 127.0.0.1:12345
179 Version 5.1.34-log
180 Server ID 12345
181 Uptime 04:56 (started 2010-06-17T11:21:22)
182 Replication Is not a slave, has 1 slaves connected
183 Filters
184 Binary logging STATEMENT
185 Slave status
186 Slave mode STRICT
187 Auto-increment increment 1, offset 1
188 +- 127.0.0.1:12346
189 Version 5.1.34-log
190 Server ID 12346
191 Uptime 04:54 (started 2010-06-17T11:21:24)
192 Replication Is a slave, has 1 slaves connected
193 Filters
194 Binary logging STATEMENT
195 Slave status 0 seconds behind, running, no errors
196 Slave mode STRICT
197 Auto-increment increment 1, offset 1
198
199 --set-vars
200 type: string; default: wait_timeout=10000
201
202 Set these MySQL variables. Immediately after connecting to MySQL,
203 this string will be appended to SET and executed.
204
205 --socket
206 short form: -S; type: string
207
208 Socket file to use for connection.
209
210 --user
211 short form: -u; type: string
212
213 User for login if not current user.
214
215 --version
216 Show version and exit.
217
219 These DSN options are used to create a DSN. Each option is given like
220 "option=value". The options are case-sensitive, so P and p are not the
221 same option. There cannot be whitespace before or after the "=" and if
222 the value contains whitespace it must be quoted. DSN options are
223 comma-separated. See the maatkit manpage for full details.
224
225 · A
226
227 dsn: charset; copy: yes
228
229 Default character set.
230
231 · D
232
233 dsn: database; copy: yes
234
235 Default database.
236
237 · F
238
239 dsn: mysql_read_default_file; copy: yes
240
241 Only read default options from the given file
242
243 · h
244
245 dsn: host; copy: yes
246
247 Connect to host.
248
249 · p
250
251 dsn: password; copy: yes
252
253 Password to use when connecting.
254
255 · P
256
257 dsn: port; copy: yes
258
259 Port number to use for connection.
260
261 · S
262
263 dsn: mysql_socket; copy: yes
264
265 Socket file to use for connection.
266
267 · u
268
269 dsn: user; copy: yes
270
271 User for login if not current user.
272
274 You can download Maatkit from Google Code at
275 <http://code.google.com/p/maatkit/>, or you can get any of the tools
276 easily with a command like the following:
277
278 wget http://www.maatkit.org/get/toolname
279 or
280 wget http://www.maatkit.org/trunk/toolname
281
282 Where "toolname" can be replaced with the name (or fragment of a name)
283 of any of the Maatkit tools. Once downloaded, they're ready to run; no
284 installation is needed. The first URL gets the latest released version
285 of the tool, and the second gets the latest trunk code from Subversion.
286
288 The environment variable "MKDEBUG" enables verbose debugging output in
289 all of the Maatkit tools:
290
291 MKDEBUG=1 mk-....
292
294 You need Perl, DBI, DBD::mysql, and some core packages that ought to be
295 installed in any reasonably new version of Perl.
296
298 For a list of known bugs see
299 <http://www.maatkit.org/bugs/mk-slave-find>.
300
301 Please use Google Code Issues and Groups to report bugs or request
302 support: <http://code.google.com/p/maatkit/>. You can also join
303 #maatkit on Freenode to discuss Maatkit.
304
305 Please include the complete command-line used to reproduce the problem
306 you are seeing, the version of all MySQL servers involved, the complete
307 output of the tool when run with "--version", and if possible,
308 debugging output produced by running with the "MKDEBUG=1" environment
309 variable.
310
312 This program is copyright 2007-2011 Baron Schwartz. Feedback and
313 improvements are welcome.
314
315 THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
316 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
317 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
318
319 This program is free software; you can redistribute it and/or modify it
320 under the terms of the GNU General Public License as published by the
321 Free Software Foundation, version 2; OR the Perl Artistic License. On
322 UNIX and similar systems, you can issue `man perlgpl' or `man
323 perlartistic' to read these licenses.
324
325 You should have received a copy of the GNU General Public License along
326 with this program; if not, write to the Free Software Foundation, Inc.,
327 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
328
330 Baron Schwartz
331
333 This tool is part of Maatkit, a toolkit for power users of MySQL.
334 Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the
335 primary code contributors. Both are employed by Percona. Financial
336 support for Maatkit development is primarily provided by Percona and
337 its clients.
338
340 This manual page documents Ver 1.0.16 Distrib 7540 $Revision: 7531 $.
341
342
343
344perl v5.28.1 2011-06-08 MK-SLAVE-FIND(1)