1MK-SLAVE-MOVE(1) User Contributed Perl Documentation MK-SLAVE-MOVE(1)
2
3
4
6 mk-slave-move - Move a MySQL slave around in the replication hierarchy.
7
9 mk-slave-move slave --sibling-of-master
10 mk-slave-move slave --slave-of-sibling sibling
11 mk-slave-move slave --slave-of-uncle uncle
12
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-move is a read-write tool by default. It manipulates
20 replication settings. Some of the features are incomplete, including
21 some safety checks such as not moving slaves that have temporary tables
22 open.
23
24 At the time of this release, we know of no bugs that could cause
25 serious harm to users.
26
27 The authoritative source for updated information is always the online
28 issue tracking system. Issues that affect this tool will be marked as
29 such. You can see a list of such issues at the following URL:
30 http://www.maatkit.org/bugs/mk-slave-move
31 <http://www.maatkit.org/bugs/mk-slave-move>.
32
33 See also "BUGS" for more information on filing bugs and getting help.
34
36 This tool knows how to disconnect and reconnect slaves to each other,
37 compare replication positions, and so on. This makes it able to move a
38 slave around the replication hierarchy safely and correctly. It
39 doesn't do anything you can't do by hand, but it is tedious and error-
40 prone to do this by hand.
41
42 The hosts are given by a DSN. A DSN is a special syntax that can be
43 either just a hostname (like "server.domain.com" or 1.2.3.4), or a
44 "key=value,key=value" string. 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 If you omit any values in the sibling or uncle host, they are filled in
56 with defaults from the slave host, so you don't need to specify them in
57 both places. "mk-slave-move" reads all normal MySQL option files, such
58 as ~/.my.cnf, so you may not need to specify username, password and
59 other common options at all.
60
62 Successful exit status is 0. Any other value represents the exit
63 status of the Perl process itself.
64
66 Specify one and only one of "--sibling-of-master",
67 "--slave-of-sibling", "--slave-of-uncle", or "--detach".
68
69 --ask-pass
70 Prompt for a password when connecting to MySQL.
71
72 --charset
73 short form: -A; type: string
74
75 Default character set. If the value is utf8, sets Perl's binmode
76 on STDOUT to utf8, passes the mysql_enable_utf8 option to
77 DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL. Any
78 other value sets binmode on STDOUT without the utf8 layer, and runs
79 SET NAMES after connecting to MySQL.
80
81 --config
82 type: Array
83
84 Read this comma-separated list of config files; if specified, this
85 must be the first option on the command line.
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 --detach
94 Make this server forget that it is a slave.
95
96 --help
97 Show help and exit.
98
99 --host
100 short form: -h; type: string
101
102 Connect to host.
103
104 --password
105 short form: -p; type: string
106
107 Password to use when connecting.
108
109 --pid
110 type: string
111
112 Create the given PID file. The file contains the process ID of the
113 script. The PID file is removed when the script exits. Before
114 starting, the script checks if the PID file already exists. If it
115 does not, then the script creates and writes its own PID to it. If
116 it does, then the script checks the following: if the file contains
117 a PID and a process is running with that PID, then the script dies;
118 or, if there is no process running with that PID, then the script
119 overwrites the file with its own PID and starts; else, if the file
120 contains no PID, then the script dies.
121
122 --port
123 short form: -P; type: int
124
125 Port number to use for connection.
126
127 --set-vars
128 type: string; default: wait_timeout=10000
129
130 Set these MySQL variables. Immediately after connecting to MySQL,
131 this string will be appended to SET and executed.
132
133 --sibling-of-master
134 Make the server a slave of its grandparent, so it is a sibling of
135 its master.
136
137 The procedure is as follows:
138
139 1. Connect to the server's master.
140 2. Stop the slave processes on the master.
141 3. Wait for the server to catch up to its master in replication.
142 4. Point the slave to the master's master.
143
144 --slave-of-sibling
145 Make the server a slave of one of its siblings. Specify the
146 sibling as a DSN.
147
148 The procedure is as follows:
149
150 1. Connect to the sibling and verify that it has the same master.
151 2. Stop the slave processes on the server and its sibling.
152 3. If one of the servers is behind the other, make it catch up.
153 4. Point the slave to its sibling.
154
155 --slave-of-uncle
156 Make the server a slave of one of its uncles (parent's siblings).
157 Specify the uncle as a DSN.
158
159 An "uncle" is a sibling of the server's master. The procedure is
160 as follows:
161
162 1. Connect to the slave's master and its uncle, and verify that both have the
163 same master. (Their common master is the slave's grandparent).
164 2. Stop the slave processes on the master and uncle.
165 3. If one of them is behind the other, make it catch up.
166 4. Point the slave to its uncle.
167
168 --socket
169 short form: -S; type: string
170
171 Socket file to use for connection.
172
173 --timeout
174 type: time; default: 10m
175
176 Timeout when waiting for replication to catch up.
177
178 --user
179 short form: -u; type: string
180
181 User for login if not current user.
182
183 --version
184 Show version and exit.
185
187 These DSN options are used to create a DSN. Each option is given like
188 "option=value". The options are case-sensitive, so P and p are not the
189 same option. There cannot be whitespace before or after the "=" and if
190 the value contains whitespace it must be quoted. DSN options are
191 comma-separated. See the maatkit manpage for full details.
192
193 · A
194
195 dsn: charset; copy: yes
196
197 Default character set.
198
199 · D
200
201 dsn: database; copy: yes
202
203 Default database.
204
205 · F
206
207 dsn: mysql_read_default_file; copy: yes
208
209 Only read default options from the given file
210
211 · h
212
213 dsn: host; copy: yes
214
215 Connect to host.
216
217 · p
218
219 dsn: password; copy: yes
220
221 Password to use when connecting.
222
223 · P
224
225 dsn: port; copy: yes
226
227 Port number to use for connection.
228
229 · S
230
231 dsn: mysql_socket; copy: yes
232
233 Socket file to use for connection.
234
235 · u
236
237 dsn: user; copy: yes
238
239 User for login if not current user.
240
242 You can download Maatkit from Google Code at
243 <http://code.google.com/p/maatkit/>, or you can get any of the tools
244 easily with a command like the following:
245
246 wget http://www.maatkit.org/get/toolname
247 or
248 wget http://www.maatkit.org/trunk/toolname
249
250 Where "toolname" can be replaced with the name (or fragment of a name)
251 of any of the Maatkit tools. Once downloaded, they're ready to run; no
252 installation is needed. The first URL gets the latest released version
253 of the tool, and the second gets the latest trunk code from Subversion.
254
256 The environment variable "MKDEBUG" enables verbose debugging output in
257 all of the Maatkit tools:
258
259 MKDEBUG=1 mk-....
260
262 You need Perl, DBI, DBD::mysql, and some core packages that ought to be
263 installed in any reasonably new version of Perl.
264
266 For list of known bugs see http://www.maatkit.org/bugs/mk-slave-move
267 <http://www.maatkit.org/bugs/mk-slave-move>.
268
269 Please use Google Code Issues and Groups to report bugs or request
270 support: <http://code.google.com/p/maatkit/>. You can also join
271 #maatkit on Freenode to discuss Maatkit.
272
273 Please include the complete command-line used to reproduce the problem
274 you are seeing, the version of all MySQL servers involved, the complete
275 output of the tool when run with "--version", and if possible,
276 debugging output produced by running with the "MKDEBUG=1" environment
277 variable.
278
280 This program is copyright 2007-2010 Baron Schwartz. Feedback and
281 improvements are welcome.
282
283 THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
284 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
285 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
286
287 This program is free software; you can redistribute it and/or modify it
288 under the terms of the GNU General Public License as published by the
289 Free Software Foundation, version 2; OR the Perl Artistic License. On
290 UNIX and similar systems, you can issue `man perlgpl' or `man
291 perlartistic' to read these licenses.
292
293 You should have received a copy of the GNU General Public License along
294 with this program; if not, write to the Free Software Foundation, Inc.,
295 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
296
298 See also mk-table-checksum, mk-table-sync, mk-slave-delay.
299
301 Baron Schwartz
302
304 This tool is part of Maatkit, a toolkit for power users of MySQL.
305 Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the
306 primary code contributors. Both are employed by Percona. Financial
307 support for Maatkit development is primarily provided by Percona and
308 its clients.
309
311 This manual page documents Ver 0.9.12 Distrib 6839 $Revision: 6831 $.
312
313
314
315perl v5.12.1 2010-08-01 MK-SLAVE-MOVE(1)