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