1MYSQLRPLADMIN(1)                MySQL Utilities               MYSQLRPLADMIN(1)
2
3
4

NAME

6       mysqlrpladmin - Administration utility for MySQL replication
7

SYNOPSIS

9       mysqlrpladmin [options]
10

DESCRIPTION

12       This utility permits users to perform administrative actions on a
13       replication topology consisting of a master and its slaves. The utility
14       is designed to make it easy to recover from planned maintenance of the
15       master, or from an event that takes the master offline unexpectedly.
16
17       The act of taking the master offline intentionally and switching
18       control to another slave is called switchover. In this case, there is
19       no loss of transactions as the master is locked and all slaves are
20       allowed to catch up to the master. Once the slaves have read all events
21       from the master, the master is shutdown and control switched to a slave
22       (in this case called a candidate slave).
23
24       Recovering from the loss of a downed master is more traumatic and since
25       there is no way to know what transactions the master may have failed to
26       send, the new master (called a candidate slave) must be the slave that
27       is most up-to-date. How this is determined depends on the version of
28       the server (see below). However, it can result in the loss of some
29       transactions that were executed on the downed master but not sent. The
30       utility accepts a list of slaves to be considered the candidate slave.
31       If no slave is found to meet the requirements, the operation will
32       search the list of known slaves.
33
34       The utility also provides a number of useful commands for managing a
35       replication topology including the following.
36
37       elect This command is available to only those servers supporting global
38       transaction identifiers (GTIDs), perform best slave election and report
39       best slave to use in the event a switchover or failover is required.
40       Best slave election is simply the first slave to meet the
41       prerequisites. GTIDs are supported in version 5.6.5 and higher. This
42       command requires the options --master and either --slaves or
43       --discover-slaves-login.
44
45       failover This command is available to only those servers supporting
46       GTIDs. Conduct failover to the best slave. The command will test each
47       candidate slave listed for the prerequisites. Once a candidate slave is
48       elected, it is made a slave of each of the other slaves thereby
49       collecting any transactions executed on other slaves but not the
50       candidate. In this way, the candidate becomes the most up-to-date
51       slave. This command requires the --slaves option. The
52       --discover-slaves-login option is not allowed because, for failover,
53       the master is presumed to be offline or otherwise unreachable (so there
54       is no way to discover the slaves). The --master option is ignored for
55       this command.
56
57       gtid This command is available to only those servers supporting GTIDs.
58       It displays the contents of the GTID variables, @@GLOBAL.GTID_EXECUTED,
59       @@GLOBAL.GTID_PURGED, and @@GLOBAL.GTID_OWNED. The command also
60       displays universally unique identifiers (UUIDs) for all servers. This
61       command requires one of the following combinations: --master and
62       --slaves, or --master and --discover-slaves-login.
63
64       health Display the replication health of the topology. By default, this
65       includes the host name, port, role (MASTER or SLAVE) of the server,
66       state of the server (UP = is connected, WARN = not connected but can
67       ping, DOWN = not connected and cannot ping), the GTID_MODE, and health
68       state. This command can be run with the following combination of
69       options:
70
71       ·   --master and --slaves
72
73       ·   --master and --discover-slaves-login
74
75       ·   --slaves
76
77
78           Note
79           The health column will display "no master specified" when
80           generating a health report for a collection of slaves and no
81           --master option specified.
82
83       The master health state is based on the following; if GTID_MODE=ON, the
84       server must have binary log enabled, and there must exist a user with
85       the REPLICATE SLAVE privilege.
86
87       The slave health state is based on the following; the IO_THREAD and
88       SQL_THREADS must be running, it must be connected to the master, there
89       are no errors, the slave delay for non-gtid enabled scenarios is not
90       more than the threshold provided by the --max-position and the slave is
91       reading the correct master log file, and slave delay is not more than
92       the --seconds-behind threshold option.
93
94       reset Execute the STOP SLAVE and RESET SLAVE commands on all slaves.
95       This command requires the --slaves option. The --discover-slaves-login
96       option is not allowed because it might not provide the expected result,
97       excluding slaves with the IO thread stopped. Optionally, the --master
98       option can also be used and in this case the utility will perform an
99       additional check to verify if the specified slaves are associated
100       (replication is configured) to the given master.
101
102       start Execute the START SLAVE command on all slaves. This command
103       requires the --slaves option. The --discover-slaves-login option is not
104       allowed because it might not provide the expected result, excluding
105       slaves with the IO thread stopped. Optionally, the --master option can
106       also be used and in this case the utility will perform an additional
107       check to verify if the specified slaves are associated (replication is
108       configured) to the given master.
109
110       stop Execute the STOP SLAVE command on all slaves. This command
111       requires the --slaves option. The --discover-slaves-login option is not
112       allowed because it might not provide the expected result, excluding
113       slaves with the IO thread stopped. Optionally, the --master option can
114       also be used and in this case the utility will perform an additional
115       check to verify if the specified slaves are associated (replication is
116       configured) to the given master.
117
118       switchover Perform slave promotion to a specified candidate slave as
119       designated by the --new-master option. This command is available for
120       both gtid-enabled servers and non-gtid-enabled scenarios. This command
121       requires one of the following combinations:
122
123       ·   --master, --new-master and --slaves
124
125       ·   --master, --new-master and --discover-slaves-login
126
127       Detection of a downed master is performed as follows. If the connection
128       to the master is lost, wait --ping seconds and check again. If the
129       master connection is lost and the master cannot be pinged or
130       reconnected, the failover event occurs.
131
132       For all commands that require specifying multiple servers, the options
133       require a comma-separated list of connection parameters in the
134       following form (where the password, port, and socket are optional).:
135
136           <*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>] or
137           <*login-path*>[:<*port*>][:<*socket*>]
138
139       The utility permits users to discover slaves connected to the master.
140       In order to use the discover slaves feature, all slaves must use the
141       --report-host and --report-port startup variables to specify the
142       correct hostname and ip port of the slave. If these are missing or
143       report the incorrect information, the slaves health may not be reported
144       correctly or the slave may not be listed at all. The 'discover slaves'
145       feature ignores any slaves it cannot connect to, or if the IO thread
146       stopped (it is not connected to the master).
147
148       The utility permits the user to demote a master to a slave during the
149       switchover operation. The --demote-master option tells the utility to,
150       once the new master is established, make the old master a slave of the
151       new master. This permits rotation of the master role among a set of
152       servers.
153
154       The utility permits the user to specify an external script to execute
155       before and after the switchover and failover commands. The user can
156       specify these with the --exec-before and --exec-after options. The
157       return code of the script is used to determine success thus each script
158       must report 0 (success) to be considered successful. If a script
159       returns a value other than 0, the result code is presented in an error
160       message.
161
162       The utility permits the user to log all actions taken during the
163       commands. The --log option requires a valid path and file name of the
164       file to use for logging operations. The log is active only when this
165       option is specified. The option --log-age specifies the age in days
166       that log entries are kept. The default is seven (7) days. Older entries
167       are automatically deleted from the log file (but only if the --log
168       option is specified).
169
170       The format of the log file includes the date and time of the event, the
171       level of the event (informational - INFO, warning - WARN, error -
172       ERROR, critical failure - CRITICAL), and the message reported by the
173       utility.
174
175       The utility has a number of options each explained in more detail
176       below. Some of the options are specific to certain commands. Warning
177       messages are issued whenever an option is used that does not apply to
178       the command requested. A brief overview of each command and its options
179       is presented in the following paragraphs.
180
181       The start, stop, and reset commands require the --slaves option to list
182       all of the slaves in the topology. Optionally, the --master option can
183       be specified for the utility to check if the specified slaves are
184       associated to the given master before executing the command, making
185       sure that the command is only applied to slaves connected to the right
186       replication master.
187
188       The options required for the elect, health and gtid commands include
189       the --master option to specify the existing master, and either the
190       --slaves option to list all of the slaves in the topology or the
191       --discover-slaves-login option to provide the user name and password to
192       discover any slaves in the topology that are registered and connected
193       to the master.
194
195       The options required for switchover include the --master option to
196       specify the existing master, the --new-master option to specify the
197       candidate slave (the slave to become the new master), and either the
198       --slaves option to list the considered slaves in the topology or the
199       --discover-slaves-login option to provide the user name and password to
200       discover any slaves in the topology that are registered and connected
201       to the master.
202
203       The failover command requires only the --slaves option to explicitly
204       list all of the slaves in the topology because it is expected that the
205       master is down when this command is used.
206
207           Note
208           The option to pass in --slaves without also passing in --master was
209           added in MySQL Utilities 1.6.0.
210
211       Use the --verbose option to see additional information in the health
212       report and additional messages during switchover or failover.
213       OPTIONS.PP mysqlrpladmin accepts the following command-line options:
214
215       ·   --help
216
217           Display a help message and exit.
218
219       ·   --license
220
221           Display license information and exit.
222
223       ·   --candidates=<candidate slave connections>
224
225           Connection information for candidate slave servers for failover.
226           Valid only with failover command. List multiple slaves in
227           comma-separated list.
228
229           To connect to a server, it is necessary to specify connection
230           parameters such as user name, host name, password, and either a
231           port or socket. MySQL Utilities provides a number of ways to
232           provide this information. All of the methods require specifying
233           your choice via a command-line option such as --server, --master,
234           --slave, etc. The methods include the following in order of most
235           secure to least secure.
236
237           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
238               visible). Example : <login-path>[:<port>][:<socket>]
239
240           ·   Use a configuration file (unencrypted, not visible) Note:
241               available in release-1.5.0. Example :
242               <configuration-file-path>[:<section>]
243
244           ·   Specify the data on the command-line (unencrypted, visible).
245               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
246
247
248       ·   --demote-master
249
250           Make master a slave after switchover.
251
252       ·   --discover-slaves-login=<slave_login>
253
254           At startup, query master for all registered slaves and use the user
255           name and password specified to connect. Supply the user and
256           password in the form <user>[:<passwd>] or <login-path>. For
257           example, --discover=joe:secret will use 'joe' as the user and
258           'secret' as the password for each discovered slave.
259
260       ·   --exec-after=<script>
261
262           Name of script to execute after failover or switchover. Script name
263           may include the path.
264
265       ·   --exec-before=<script>
266
267           Name of script to execute before failover or switchover. Script
268           name may include the path.
269
270       ·   --force
271
272           Ignore prerequisite checks or any inconsistencies found, such as
273           errant transactions on the slaves or SQL thread errors, thus
274           forcing the execution of the specified command. This option need to
275           be used carefully as it will not solve any detected issue, but only
276           ignores them and displays a warning message.
277
278       ·   --format=<format>, -f <format>
279
280           Display the replication health output in either grid (default),
281           tab, csv, or vertical format.
282
283       ·   --log=<log_file>
284
285           Specify a log file to use for logging messages
286
287       ·   --log-age=<days>
288
289           Specify maximum age of log entries in days. Entries older than this
290           will be purged on startup. Default = 7 days.
291
292       ·   --master=<connection>
293
294           Connection information for the master server.
295
296           To connect to a server, it is necessary to specify connection
297           parameters such as user name, host name, password, and either a
298           port or socket. MySQL Utilities provides a number of ways to
299           provide this information. All of the methods require specifying
300           your choice via a command-line option such as --server, --master,
301           --slave, etc. The methods include the following in order of most
302           secure to least secure.
303
304           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
305               visible). Example : <login-path>[:<port>][:<socket>]
306
307           ·   Use a configuration file (unencrypted, not visible) Note:
308               available in release-1.5.0. Example :
309               <configuration-file-path>[:<section>]
310
311           ·   Specify the data on the command-line (unencrypted, visible).
312               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
313
314
315       ·   --max-position=<position>
316
317           Used to detect slave delay. The maximum difference between the
318           master's log position and the slave's reported read position of the
319           master. A value greater than this means the slave is too far behind
320           the master. Default = 0.
321
322       ·   --new-master=<connection>
323
324           Connection information for the slave to be used to replace the
325           master for switchover. Valid only with switchover command.
326
327           To connect to a server, it is necessary to specify connection
328           parameters such as user name, host name, password, and either a
329           port or socket. MySQL Utilities provides a number of ways to
330           provide this information. All of the methods require specifying
331           your choice via a command-line option such as --server, --master,
332           --slave, etc. The methods include the following in order of most
333           secure to least secure.
334
335           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
336               visible). Example : <login-path>[:<port>][:<socket>]
337
338           ·   Use a configuration file (unencrypted, not visible) Note:
339               available in release-1.5.0. Example :
340               <configuration-file-path>[:<section>]
341
342           ·   Specify the data on the command-line (unencrypted, visible).
343               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
344
345
346       ·   --no-health
347
348           Turn off health report after switchover or failover.
349
350       ·   --ping=<number>
351
352           Number of ping attempts for detecting downed server. Note: on some
353           platforms this is the same as number of seconds to wait for ping to
354           return. This value is also used to check down status of master.
355           Failover will wait ping seconds to check master response. If no
356           response, failover event occurs.
357
358       ·   --quiet, -q
359
360           Turn off all messages for quiet execution.
361
362       ·   --rpl-user=<replication_user>
363
364           The user and password for the replication user requirement, in the
365           format: <user>[:<password>] or <login-path>. E.g. rpl:passwd
366           Default = None.
367
368       ·   --script-threshold=<return_code>
369
370           Value for external scripts to trigger aborting the operation if
371           result is greater than or equal to the threshold.
372
373           Default = None (no threshold checking).
374
375       ·   --seconds-behind=<seconds>
376
377           Used to detect slave delay. The maximum number of seconds behind
378           the master permitted before slave is considered behind the master.
379           Default = 0.
380
381       ·   --slaves=<slave connections>
382
383           Connection information for slave servers. List multiple slaves in
384           comma-separated list. The list will be evaluated literally whereby
385           each server is considered a slave to the master listed regardless
386           if they are a slave of the master.
387
388           To connect to a server, it is necessary to specify connection
389           parameters such as user name, host name, password, and either a
390           port or socket. MySQL Utilities provides a number of ways to
391           provide this information. All of the methods require specifying
392           your choice via a command-line option such as --server, --master,
393           --slave, etc. The methods include the following in order of most
394           secure to least secure.
395
396           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
397               visible). Example : <login-path>[:<port>][:<socket>]
398
399           ·   Use a configuration file (unencrypted, not visible) Note:
400               available in release-1.5.0. Example :
401               <configuration-file-path>[:<section>]
402
403           ·   Specify the data on the command-line (unencrypted, visible).
404               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
405
406
407       ·   --ssl-ca
408
409           The path to a file that contains a list of trusted SSL CAs.
410
411       ·   --ssl-cert
412
413           The name of the SSL certificate file to use for establishing a
414           secure connection.
415
416       ·   --ssl-cert
417
418           The name of the SSL key file to use for establishing a secure
419           connection.
420
421       ·   --ssl
422
423           Specifies if the server connection requires use of SSL. If an
424           encrypted connection cannot be established, the connection attempt
425           fails. Default setting is 0 (SSL not required).
426
427       ·   --timeout=<seconds>
428
429           Maximum timeout in seconds to wait for each replication command to
430           complete. For example, timeout for slave waiting to catch up to
431           master. Default = 300 seconds.
432
433       ·   --verbose, -v
434
435           Specify how much information to display. Use this option multiple
436           times to increase the amount of information. For example, -v =
437           verbose, -vv = more verbose, -vvv = debug.
438
439       ·   --version
440
441           Display version information and exit.
442       NOTES.PP The login user must have the appropriate permissions to
443       execute SHOW SLAVE STATUS, SHOW MASTER STATUS, and SHOW VARIABLES on
444       the appropriate servers as well as grant the REPLICATE SLAVE privilege.
445       The utility checks permissions for the master, slaves, and candidates
446       at startup.
447
448       Mixing IP and hostnames is not recommended. The replication-specific
449       utilities will attempt to compare hostnames and IP addresses as aliases
450       for checking slave connectivity to the master. However, if your
451       installation does not support reverse name lookup, the comparison could
452       fail. Without the ability to do a reverse name lookup, the replication
453       utilities could report a false negative that the slave is (not)
454       connected to the master.
455
456       For example, if you setup replication using "MASTER_HOST=ubuntu.net" on
457       the slave and later connect to the slave with mysqlrplcheck and have
458       the master specified as "--master=192.168.0.6" using the valid IP
459       address for "ubuntu.net", you must have the ability to do a reverse
460       name lookup to compare the IP (192.168.0.6) and the hostname
461       (ubuntu.net) to determine if they are the same machine.
462
463       Similarly, if you use localhost to connect to the master, the health
464       report may not show all of the slaves. It is best to use the actual
465       hostname of the master when connecting or setting up replication.
466
467       If the user does not specify the --rpl-user and the user has specified
468       the switchover or failover command, the utility will check to see if
469       the slaves are using --master-info-repository=TABLE. If they are not,
470       the utility will stop with an error.
471
472       All the commands require either the --slaves or --discover-slaves-login
473       option but both cannot be used at the same time. In fact, some commands
474       only allow the use of the --slaves option which is safer to specify the
475       list slaves, because --discover-slaves-login might not provide an up to
476       date list of available slaves.
477
478       The path to the MySQL client tools should be included in the PATH
479       environment variable in order to use the authentication mechanism with
480       login-paths. This will allow the utility to use the my_print_defaults
481       tools which is required to read the login-path values from the login
482       configuration file (.mylogin.cnf).  EXAMPLES.PP To perform best slave
483       election for a topology with GTID_MODE=ON (server version 5.6.5 or
484       higher) where all slaves are specified with the --slaves option, run
485       the following command.:
486
487           shell> mysqlrpladmin --master=root@localhost:3331 \
488                     --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 elect
489           # Electing candidate slave from known slaves.
490           # Best slave found is located on localhost:3332.
491           # ...done.
492
493       To perform best slave election supplying a candidate list, use the
494       following command.:
495
496           shell> mysqlrpladmin --master=root@localhost:3331 \
497             --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \
498             --candidates=root@localhost:3333,root@localhost:3334 elect
499           # Electing candidate slave from candidate list then slaves list.
500           # Best slave found is located on localhost:3332.
501           # ...done.
502
503       To perform failover after a master has failed, use the following
504       command.:
505
506           shell> mysqlrpladmin  \
507             --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \
508             --candidates=root@localhost:3333,root@localhost:3334 failover
509           # Performing failover.
510           # Candidate slave localhost:3333 will become the new master.
511           # Preparing candidate for failover.
512           # Creating replication user if it does not exist.
513           # Stopping slaves.
514           # Performing STOP on all slaves.
515           # Switching slaves to new master.
516           # Starting slaves.
517           # Performing START on all slaves.
518           # Checking slaves for errors.
519           # Failover complete.
520           # ...done.
521
522       To see the replication health of a topology with GTID_MODE=ON (server
523       version 5.6.5 or higher) and discover all slaves attached to the
524       master, run the following command. We use the result of the failover
525       command above.:
526
527           shell> mysqlrpladmin --master=root@localhost:3333 \
528             --slaves=root@localhost:3332,root@localhost:3334 health
529           # Getting health for master: localhost:3333.
530           #
531           # Replication Topology Health:
532           +------------+-------+---------+--------+------------+---------+
533           | host       | port  | role    | state  | gtid_mode  | health  |
534           +------------+-------+---------+--------+------------+---------+
535           | localhost  | 3333  | MASTER  | UP     | ON         | OK      |
536           | localhost  | 3332  | SLAVE   | UP     | ON         | OK      |
537           | localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
538           +------------+-------+---------+--------+------------+---------+
539           # ...done.
540
541       To view a detailed replication health report but with all of the
542       replication health checks revealed, use the --verbose option as shown
543       below. In this example, we use vertical format to make viewing easier.:
544
545           shell> mysqlrpladmin --master=root@localhost:3331 \
546                     --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \
547                     --verbose health
548           # Getting health for master: localhost:3331.
549           # Attempting to contact localhost ... Success
550           # Attempting to contact localhost ... Success
551           # Attempting to contact localhost ... Success
552           # Attempting to contact localhost ... Success
553           #
554           # Replication Topology Health:
555           *************************       1. row *************************
556                       host: localhost
557                       port: 3331
558                       role: MASTER
559                      state: UP
560                  gtid_mode: ON
561                     health: OK
562                    version: 5.6.5-m8-debug-log
563            master_log_file: mysql-bin.000001
564             master_log_pos: 571
565                  IO_Thread:
566                 SQL_Thread:
567                Secs_Behind:
568            Remaining_Delay:
569               IO_Error_Num:
570                   IO_Error:
571           *************************       2. row *************************
572                       host: localhost
573                       port: 3332
574                       role: SLAVE
575                      state: UP
576                  gtid_mode: ON
577                     health: OK
578                    version: 5.6.5-m8-debug-log
579            master_log_file: mysql-bin.000001
580             master_log_pos: 571
581                  IO_Thread: Yes
582                 SQL_Thread: Yes
583                Secs_Behind: 0
584            Remaining_Delay: No
585               IO_Error_Num: 0
586                   IO_Error:
587           *************************       3. row *************************
588                       host: localhost
589                       port: 3333
590                       role: SLAVE
591                      state: UP
592                  gtid_mode: ON
593                     health: OK
594                    version: 5.6.5-m8-debug-log
595            master_log_file: mysql-bin.000001
596             master_log_pos: 571
597                  IO_Thread: Yes
598                 SQL_Thread: Yes
599                Secs_Behind: 0
600            Remaining_Delay: No
601               IO_Error_Num: 0
602                   IO_Error:
603           *************************       4. row *************************
604                       host: localhost
605                       port: 3334
606                       role: SLAVE
607                      state: UP
608                  gtid_mode: ON
609                     health: OK
610                    version: 5.6.5-m8-debug-log
611            master_log_file: mysql-bin.000001
612             master_log_pos: 571
613                  IO_Thread: Yes
614                 SQL_Thread: Yes
615                Secs_Behind: 0
616            Remaining_Delay: No
617               IO_Error_Num: 0
618                   IO_Error:
619           4 rows.
620           # ...done.
621
622       To run the same failover command above, but specify a log file, use the
623       following command.:
624
625           shell> mysqlrpladmin  \
626             --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \
627             --candidates=root@localhost:3333,root@localhost:3334 \
628             --log=test_log.txt failover
629           # Performing failover.
630           # Candidate slave localhost:3333 will become the new master.
631           # Preparing candidate for failover.
632           # Creating replication user if it does not exist.
633           # Stopping slaves.
634           # Performing STOP on all slaves.
635           # Switching slaves to new master.
636           # Starting slaves.
637           # Performing START on all slaves.
638           # Checking slaves for errors.
639           # Failover complete.
640           # ...done.
641
642       After this command, the log file will contain entries like the
643       following:
644
645           2012-03-19 14:44:17 PM INFO Executing failover command...
646           2012-03-19 14:44:17 PM INFO Performing failover.
647           2012-03-19 14:44:17 PM INFO Candidate slave localhost:3333 will become the new master.
648           2012-03-19 14:44:17 PM INFO Preparing candidate for failover.
649           2012-03-19 14:44:19 PM INFO Creating replication user if it does not exist.
650           2012-03-19 14:44:19 PM INFO Stopping slaves.
651           2012-03-19 14:44:19 PM INFO Performing STOP on all slaves.
652           2012-03-19 14:44:19 PM INFO Switching slaves to new master.
653           2012-03-19 14:44:20 PM INFO Starting slaves.
654           2012-03-19 14:44:20 PM INFO Performing START on all slaves.
655           2012-03-19 14:44:20 PM INFO Checking slaves for errors.
656           2012-03-19 14:44:21 PM INFO Failover complete.
657           2012-03-19 14:44:21 PM INFO ...done.
658
659       To perform switchover and demote the current master to a slave, use the
660       following command.:
661
662           shell> mysqlrpladmin --master=root@localhost:3331 \
663             --slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \
664             --new-master=root@localhost:3332 --demote-master switchover
665           # Performing switchover from master at localhost:3331 to slave at localhost:3332.
666           # Checking candidate slave prerequisites.
667           # Waiting for slaves to catch up to old master.
668           # Stopping slaves.
669           # Performing STOP on all slaves.
670           # Demoting old master to be a slave to the new master.
671           # Switching slaves to new master.
672           # Starting all slaves.
673           # Performing START on all slaves.
674           # Checking slaves for errors.
675           # Switchover complete.
676           # ...done.
677
678       If the replication health report is generated on the topology following
679       the above command, it will display the old master as a slave as shown
680       below.:
681
682           # Replication Topology Health:
683           +------------+-------+---------+--------+------------+---------+
684           | host       | port  | role    | state  | gtid_mode  | health  |
685           +------------+-------+---------+--------+------------+---------+
686           | localhost  | 3332  | MASTER  | UP     | ON         | OK      |
687           | localhost  | 3331  | SLAVE   | UP     | ON         | OK      |
688           | localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
689           | localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
690           +------------+-------+---------+--------+------------+---------+
691
692       You can use the discover slaves feature, if and only if all slaves
693       report their host and port to the master. A sample command to generate
694       a replication health report with discovery is shown below. Note that
695       the option --discover-slaves-login cannot be used in conjunction with
696       the --slaves option.:
697
698           shell> mysqlrpladmin --master=root@localhost:3332 --discover-slaves-login=root  health
699           # Discovering slaves for master at localhost:3332
700           # Discovering slave at localhost:3331
701           # Found slave: localhost:3331
702           # Discovering slave at localhost:3333
703           # Found slave: localhost:3333
704           # Discovering slave at localhost:3334
705           # Found slave: localhost:3334
706           # Checking privileges.
707           #
708           # Replication Topology Health:
709           +------------+-------+---------+--------+------------+---------+
710           | host       | port  | role    | state  | gtid_mode  | health  |
711           +------------+-------+---------+--------+------------+---------+
712           | localhost  | 3332  | MASTER  | UP     | ON         | OK      |
713           | localhost  | 3331  | SLAVE   | UP     | ON         | OK      |
714           | localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
715           | localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
716           +------------+-------+---------+--------+------------+---------+
717           # ...done.
718
719       PERMISSIONS REQUIRED.PP The users on the master need the following
720       privileges: SELECT and INSERT privileges on mysql database, REPLICATION
721       SLAVE, REPLICATION CLIENT and GRANT OPTION. The slave users need the
722       SUPER privilege. The repl user, used as the argument for the --rpl-user
723       option, is either created automatically or if it exists, it needs the
724       REPLICATION SLAVE privilege.
725
726       To run the mysqlrpladmin utility with the health command, the account
727       used on the master needs an extra SUPER privilege.
728
729       As for the switchover command all the users need the following
730       privileges: SUPER, GRANT OPTION, SELECT, RELOAD, DROP, CREATE and
731       REPLICATION SLAVE
732
734       Copyright © 2006, 2015, Oracle and/or its affiliates. All rights
735       reserved.
736
737       This documentation is free software; you can redistribute it and/or
738       modify it only under the terms of the GNU General Public License as
739       published by the Free Software Foundation; version 2 of the License.
740
741       This documentation is distributed in the hope that it will be useful,
742       but WITHOUT ANY WARRANTY; without even the implied warranty of
743       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
744       General Public License for more details.
745
746       You should have received a copy of the GNU General Public License along
747       with the program; if not, write to the Free Software Foundation, Inc.,
748       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
749       http://www.gnu.org/licenses/.
750
751

SEE ALSO

753       For more information, please refer to the MySQL Utilities and Fabric
754       documentation, which is available online at
755       http://dev.mysql.com/doc/index-utils-fabric.html
756

AUTHOR

758       Oracle Corporation (http://dev.mysql.com/).
759
760
761
762MySQL 1.5.6                       09/15/2015                  MYSQLRPLADMIN(1)
Impressum