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