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

NAME

6       mysqlfailover - Automatic replication failover
7

SYNOPSIS

9       mysqlfailover [options]
10

DESCRIPTION

12       This utility permits users to perform replication health monitoring and
13       automatic failover on a replication topology consisting of a master and
14       its slaves. The utility is designed to run interactively or
15       continuously refreshing the health information at periodic intervals.
16       Its primary mission is to monitor the master for failure and when a
17       failure occurs, execute failover to the best slave available. The
18       utility accepts a list of slaves to be considered the candidate slave.
19
20       This utility is designed to work exclusively for servers that support
21       global transaction identifiers (GTIDs) and have gtid_mode=ON. MySQL
22       server versions 5.6.5 and higher support GTIDs. See Replication with
23       Global Transaction Identifiers[1] for more information.
24
25       The user can specify the interval in seconds to use for detecting the
26       master status and generating the health report using the --interval
27       option. At each interval, the utility will check to see if the server
28       is alive via a ping operation followed by a check of the connector to
29       detect if the server is still reachable. The ping operation can be
30       controlled with the --ping option (see below).
31
32       If the master is found to be offline or unreachable, the utility will
33       execute one of the following actions based on the --failover-mode
34       option value. The available values are:
35
36       ·   auto (default): Execute automatic failover to the list of
37           candidates first and if no slaves are viable, continue to locate a
38           viable candidate from the list of slaves. If no slaves are found to
39           be a viable candidate, the utility will generate and error and
40           exit.
41
42           Once a candidate is found, the utility will conduct failover to the
43           best slave. The command will test each candidate slave listed for
44           the prerequisites. Once a candidate slave is elected, it is made a
45           slave of each of the other slaves thereby collecting any
46           transactions executed on other slaves but not the candidate. In
47           this way, the candidate becomes the most up-to-date slave.
48
49       ·   elect: This mode is the same as auto, except if no candidates
50           specified in the list of candidate slaves are viable, then it does
51           not check the remaining slaves, and instead generates an error and
52           then exits.
53
54       ·   fail: This mode produces an error and does not failover when the
55           master is downed. This mode is used to provide periodic health
56           monitoring without the failover action taken.
57
58       For all options that permit specifying multiple servers, the options
59       require a comma-separated list of connection parameters in the
60       following form (where the password, port, and socket are optional).:
61
62           <*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>] or
63           <*login-path*>[:<*port*>][:<*socket*>]
64
65       The utility permits users to discover slaves connected to the master.
66       In order to use the discover slaves feature, all slaves must use the
67       --report-host and --report-port startup variables to specify the
68       correct hostname and port of the slave. If these are missing or report
69       the incorrect information, the slave's health may not be reported
70       correctly or the slave may not be listed at all. The discover slaves
71       feature ignores any slaves to which it cannot connect.
72
73       The discover slaves feature is run automatically on each interval.
74
75       The utility permits the user to specify an external script to execute
76       before and after the switchover and failover commands. The user can
77       specify these with the --exec-before and --exec-after options. The
78       return code of the script is used to determine success thus each script
79       must report 0 (success) to be considered successful. If a script
80       returns a value other than 0, the result code is presented in an error
81       message.
82
83       The utility also permits the user to specify a script to be used for
84       detecting a downed master or an application-level event to trigger
85       failover. This can be specified using the --exec-fail-check option. The
86       return code for the script is used to invoke failover. A return code of
87       0 indicates failover should not take place. A return code other than 0
88       indicates failover should take place. This is checked at the start of
89       each interval if a script is supplied. The timeout option is not used
90       in this case and the script is run once at the start of each interval.
91
92       The utility permits the user to log all actions taken during the
93       commands. The --log option requires a valid path and file name of the
94       file to use for logging operations. The log is active only when this
95       option is specified. The option --log-age specifies the age in days
96       that log entries are kept. The default is seven (7) days. Older entries
97       are automatically deleted from the log file (but only if the --log
98       option is specified).
99
100       The format of the log file includes the date and time of the event, the
101       level of the event (informational - INFO, warning - WARN, error -
102       ERROR, critical failure - CRITICAL), and the message reported by the
103       utility.
104
105       The interface provides a number of options for displaying additional
106       information. You can choose to view the replication health report
107       (default), or choose to view the list of GTIDs in use, the UUIDs in
108       use, or view the log file contents if logging is enabled. Each of these
109       reports is described below.
110
111       ·   health Display the replication health of the topology. This report
112           is the default view for the interface. By default, this includes
113           the host name, port, role (MASTER or SLAVE) of the server, state of
114           the server (UP = is connected, WARN = not connected but can ping,
115           DOWN = not connected and cannot ping), the GTID_MODE, and health
116           state.
117
118           The master health state is based on the following: if GTID_MODE=ON,
119           the server must have the binary log enabled, and a user must exist
120           with the REPLICATE SLAVE privilege.
121
122           The --seconds-behind option is used to detect when a slave is
123           behind the master. It allows users to set a threshold for reporting
124           purposes only. It does not apply to slave candidacy or selection
125           during failover.
126
127           The slave health state is based on the following: the IO_THREAD and
128           SQL_THREADS must be running, it must be connected to the master,
129           there are no errors, the slave delay for non-GTID enabled scenarios
130           is not more than the threshold provided by the --max-position and
131           the slave is reading the correct master log file, and slave delay
132           is not more than the --seconds-behind threshold option.
133
134           At each interval, if the discover slaves option was specified at
135           startup and new slaves are discovered, the health report is
136           refreshed.
137
138       ·   gtid: Display the master's list of executed GTIDs, contents of the
139           GTID variables; @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_PURGED, and
140           @@GLOBAL.GTID_OWNED. Thus, you can toggle through the four screens
141           by pressing the 'G' key.
142
143       ·   UUID: Display universally unique identifiers (UUIDs) for all
144           servers.
145
146       ·   Log: This option displays the contents of the log file, which only
147           visible if the --log option is specified. This can be helpful to
148           see when failover occurred, and which actions or messages were
149           recorded at the time.
150
151       The user interface is designed to match the size of the terminal window
152       in which it is run. A refresh option is provided to permit users to
153       resize their terminal windows or refresh the display at any time.
154       However, the interface will automatically resize to the terminal window
155       on each interval.
156
157       The interface will display the name of the utility, the master's status
158       including binary log file, position, and filters as well as the date
159       and time of the next interval event.
160
161       The interface will also permit the user to scroll up or down through a
162       list longer than what the terminal window permits. When a long list is
163       presented, the scroll options become enabled. The user can scroll the
164       list up with the up arrow key and down with the down arrow key.
165
166       Use the --verbose option to see additional information in the health
167       report and additional messages during failover.
168
169       The utility supports two modes of operation. The default mode, running
170       as a console, works as described above. An additional mode that permits
171       you to run the utility as a daemon is provided for POSIX platforms.
172
173       When run as a daemon, the utility does not have interactivity. However,
174       all events are written to the log file. You can control what is written
175       to the log by using the --report-values option.
176
177       To run the utility as a daemon, use the --daemon option. There are four
178       commands that can be used in --daemon option. These include:
179
180       ·   start
181
182           Starts the daemon. The --log option is required.
183
184       ·   stop
185
186           Stops the daemon. If you used the option --pidfile, the value must
187           be the same when starting the daemon.
188
189       ·   restart
190
191           Restarts the daemon. If you used the option --pidfile, the value
192           must be the same when starting the daemon.
193
194       ·   nodetach
195
196           Starts the daemon, but it will not detach the process from the
197           console. The --log option is required.
198       OPTIONS.PP mysqlfailover accepts the following command-line options:
199
200       ·   --help
201
202           Display a help message and exit.
203
204       ·   --license
205
206           Display license information and exit.
207
208       ·   --candidates=<candidate slave connections>
209
210           Connection information for candidate slave servers. Valid only with
211           failover command. List multiple slaves in comma-separated list.
212
213           To connect to a server, it is necessary to specify connection
214           parameters such as user name, host name, password, and either a
215           port or socket. MySQL Utilities provides a number of ways to
216           provide this information. All of the methods require specifying
217           your choice via a command-line option such as --server, --master,
218           --slave, etc. The methods include the following in order of most
219           secure to least secure.
220
221           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
222               visible). Example : <login-path>[:<port>][:<socket>]
223
224           ·   Use a configuration file (unencrypted, not visible) Note:
225               available in release-1.5.0. Example :
226               <configuration-file-path>[:<section>]
227
228           ·   Specify the data on the command-line (unencrypted, visible).
229               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
230
231
232       ·   --daemon=<command>
233
234           Run as a daemon. The command can be start (start daemon), stop
235           (stop daemon), restart (stop then start the daemon) or nodetach
236           (start but do not detach the process). This option is only
237           available for POSIX systems.
238
239       ·   --discover-slaves-login=<user:password>
240
241           At startup, query master for all registered slaves and use the user
242           name and password specified to connect. Supply the user and
243           password in the form <user>[:<passwd>] or <login-path>. For
244           example, --discover=joe:secret will use 'joe' as the user and
245           'secret' as the password for each discovered slave.
246
247       ·   --exec-after=<script>
248
249           Name of script to execute after failover or switchover. Script name
250           may include the path.
251
252       ·   --exec-before=<script>
253
254           Name of script to execute before failover or switchover. Script
255           name may include the path.
256
257       ·   --exec-fail-check=<script>
258
259           Name of script to execute on each interval to invoke failover.
260
261       ·   --exec-post-failover=<script>
262
263           Name of script to execute after failover is complete and the
264           utility has refreshed the health report.
265
266       ·   --failover-mode=<mode>, -f <mode>
267
268           Action to take when the master fails. 'auto' = automatically fail
269           to best slave, 'elect' = fail to candidate list or if no candidate
270           meets criteria fail, 'fail' = take no action and stop when master
271           fails. Default = 'auto'.
272
273       ·   --force
274
275           Override the registration check on master for multiple instances of
276           the console monitoring the same master. See notes.
277
278       ·   --interval=<seconds>, -i <seconds>
279
280           Interval in seconds for polling the master for failure and
281           reporting health. Default = 15 seconds. Minimum is 5 seconds.
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       ·   --pedantic, -p
323
324           Used to stop failover if some inconsistencies are found, such as
325           errant transactions on slaves or SQL thread errors, during server
326           checks. By default, the utility only generates warnings if issues
327           are found when checking a slave's status during failover, and it
328           will continue its execution unless this option is specified.
329
330       ·   --pidfile=<pidfile>
331
332           Pidfile for running mysqlfailover as a daemon. This file contains
333           the PID (process identifier), that uniquely identifies a process.
334           It is needed to identify and control the process forked by
335           mysqlfailover.
336
337       ·   --ping=<number>
338
339           Number of ping attempts for detecting a downed server. Default is 3
340           seconds.
341
342               Note
343               On some platforms, this is the same as number of seconds to
344               wait for ping to return.
345
346       ·   --report-values=<report_values>
347
348           Report values used in mysqlfailover running as a daemon. It can be
349           health, gtid or uuid. Multiple values can be used separated by
350           commas.
351
352           ·   health
353
354               Display the replication health of the topology.
355
356           ·   gtid
357
358               Display the master's list of executed GTIDs, contents of the
359               GTID variables; @@GLOBAL.GTID_EXECUTED, @@GLOBAL.GTID_PURGED
360               and @@GLOBAL.GTID_OWNED.
361
362           ·   uuid
363
364               Display universally unique identifiers (UUIDs) for all servers.
365
366           Default = health.
367
368       ·   --rpl-user=:<replication_user>
369
370           The user and password for the replication user requirement, in the
371           form: <user>[:<password>] or <login-path>. E.g. rpl:passwd
372
373           Default = None.
374
375       ·   --script-threshold=<return_code>
376
377           Value for external scripts to trigger aborting the operation if
378           result is greater than or equal to the threshold.
379
380           Default = None (no threshold checking).
381
382       ·   --seconds-behind=<seconds>
383
384           Used to detect slave delay (only for health reporting purposes).
385           The maximum number of seconds behind the master permitted before
386           slave is considered behind the master in the health report state.
387           Default = 0.
388
389       ·   --slaves=<slave connections>
390
391           Connection information for slave servers. List multiple slaves in
392           comma-separated list. The list will be evaluated literally whereby
393           each server is considered a slave to the master listed regardless
394           if they are a slave of the master.
395
396           To connect to a server, it is necessary to specify connection
397           parameters such as user name, host name, password, and either a
398           port or socket. MySQL Utilities provides a number of ways to
399           provide this information. All of the methods require specifying
400           your choice via a command-line option such as --server, --master,
401           --slave, etc. The methods include the following in order of most
402           secure to least secure.
403
404           ·   Use login-paths from your .mylogin.cnf file (encrypted, not
405               visible). Example : <login-path>[:<port>][:<socket>]
406
407           ·   Use a configuration file (unencrypted, not visible) Note:
408               available in release-1.5.0. Example :
409               <configuration-file-path>[:<section>]
410
411           ·   Specify the data on the command-line (unencrypted, visible).
412               Example : <user>[:<passwd>]@<host>[:<port>][:<socket>]
413
414
415       ·   --ssl-ca
416
417           The path to a file that contains a list of trusted SSL CAs.
418
419       ·   --ssl-cert
420
421           The name of the SSL certificate file to use for establishing a
422           secure connection.
423
424       ·   --ssl-key
425
426           The name of the SSL key file to use for establishing a secure
427           connection.
428
429       ·   --ssl
430
431           Specifies if the server connection requires use of SSL. If an
432           encrypted connection cannot be established, the connection attempt
433           fails. Default setting is 0 (SSL not required).
434
435       ·   --timeout=<seconds>
436
437           Maximum timeout in seconds to wait for each replication command to
438           complete. For example, timeout for slave waiting to catch up to
439           master.
440
441           Default = 3.
442
443       ·   --verbose, -v
444
445           Specify how much information to display. Use this option multiple
446           times to increase the amount of information. For example, -v =
447           verbose, -vv = more verbose, -vvv = debug.
448
449       ·   --version
450
451           Display version information and exit.
452       NOTES.PP The login user must have the appropriate permissions for the
453       utility to check servers and monitor their status (e.g., SHOW SLAVE
454       STATUS, SHOW MASTER STATUS). The user must also have permissions to
455       execute the failover procedure (e.g., STOP SLAVE, START SLAVE,
456       WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS, CHANGE MASTER TO ...). Lastly, the
457       user must have the REPLICATE SLAVE privilege for slaves to connect to
458       their master. The same permissions are required by the failover utility
459       for master and slaves in order to run successfully. In particular,
460       users connected to slaves, candidates and master require SUPER, GRANT
461       OPTION, REPLICATION SLAVE, RELOAD, DROP, CREATE, INSERT and SELECT
462       privileges.
463
464       The DROP, CREATE, INSERT and SELECT privileges are required to register
465       the failover instance on the initial master or the new master (after a
466       successful failover). Therefore, since any slave can become the new
467       master, slaves and candidates also require those privileges. The
468       utility checks permissions for the master, slaves, and candidates at
469       startup.
470
471       At startup, the console will attempt to register itself with the
472       master. If another console is already registered, and the failover mode
473       is auto or elect, the console will be blocked from running failover.
474       When a console quits, it unregisters itself from the master. If this
475       process is broken, the user may override the registration check by
476       using the --force option.
477
478       Mixing IP and hostnames is not recommended. The replication-specific
479       utilities will attempt to compare hostnames and IP addresses as aliases
480       for checking slave connectivity to the master. However, if your
481       installation does not support reverse name lookup, the comparison could
482       fail. Without the ability to do a reverse name lookup, the replication
483       utilities could report a false negative that the slave is (not)
484       connected to the master.
485
486       For example, if you setup replication using MASTER_HOST=ubuntu.net on
487       the slave and later connect to the slave with mysqlrplcheck and have
488       the master specified as --master=192.168.0.6 using the valid IP address
489       for ubuntu.net, you must have the ability to do a reverse name lookup
490       to compare the IP (192.168.0.6) and the hostname (ubuntu.net) to
491       determine if they are the same machine.
492
493       Similarly, in order to avoid issues mixing local IP '127.0.0.1' with
494       'localhost', all the addresses '127.0.0.1' will be internally converted
495       to 'localhost' by the utility. Nevertheless, It is best to use the
496       actual hostname of the master when connecting or setting up
497       replication.
498
499       The utility will check to see if the slaves are using the option
500       --master-info-repository=TABLE. If they are not, the utility will stop
501       with an error.
502
503       The path to the MySQL client tools should be included in the PATH
504       environment variable in order to use the authentication mechanism with
505       login-paths. This will allow the utility to use the my_print_defaults
506       tools which is required to read the login-path values from the login
507       configuration file (.mylogin.cnf).
508
509       The console creates a special table in the mysql database that is used
510       to keep track of which instance is communicating with the master. If
511       you use the --force option, the console will remove the rows in this
512       table. The table is constructed with:
513
514           CREATE TABLE IF NOT EXISTS mysql.failover_console (host char(30), port char(10))
515
516       When the console starts, a row is inserted containing the hostname and
517       port of the master. On startup, if a row matches these values, the
518       console will not start. If you use the --force option, the row is
519       deleted.
520
521       When running the utility using the --daemon=nodetach option, the
522       --pidfile option can be omitted. It will be ignored if used.
523
524       When using the external scripts, the following parameters are passed in
525       the order shown.
526
527       For example, suppose you have a script named 'run_before.sh' and you
528       specify that you want it executing before the failover is performed
529       (using the --exec-before option). Further, let us assume the master
530       MySQL Server is using port 3306 on the host ‘host1’ and the MySQL
531       Server that will become the new master is using port 3308 on host
532       'can_host2'. The script would therefore be invoked in the following
533       manner.
534
535           % run_before.sh host1 3306 can_host2 3308
536
537       Table 5.2. External Script Parameters
538       ┌─────────────────────────┬───────────────────────────┐
539MySQL Failover Option    Parameters Passed to      
540       │                         │ External Script           
541       ├─────────────────────────┼───────────────────────────┤
542--exec-before            │ master host, master port, │
543       │                         │ candidate host, candidate │
544       │                         │ port                      │
545       ├─────────────────────────┼───────────────────────────┤
546--exec-after             │ new master host, new      │
547       │                         │ master port               │
548       ├─────────────────────────┼───────────────────────────┤
549--exec-fail-check        │ master host, master port  │
550       ├─────────────────────────┼───────────────────────────┤
551--exec-post-failover (no │ old master host, old      │
552       │errors                   │ master port, new master   │
553       │              during     │ host, new master port     │
554       │failover)                │                           │
555       ├─────────────────────────┼───────────────────────────┤
556--exec-post-failover     │ old master host, old      │
557       │(errors                  │ master port               │
558       │              during     │                           │
559       │failover)                │                           │
560       └─────────────────────────┴───────────────────────────┘
561       EXAMPLES.PP To launch the utility, you must specify at a minimum the
562       --master option and either the --discover-slaves-login option or the
563       --slaves option. The --discover-slaves-login option can be used in
564       conjunction with the --slaves option to specify a list of known slaves
565       (or slaves that do not report their host and IP) and to discover any
566       other slaves connected to the master.
567
568       An example of the user interface and some of the report views are shown
569       in the following examples.
570
571           Note
572           The "GTID Executed Set" will display the first GTID listed in the
573           SHOW MASTER STATUS view. If there are multiple GTIDs listed, the
574           utility shall display [...]  to indicate there are additional GTIDs
575           to view. You can view the complete list of GTIDs on the GTID
576           display screens.
577
578       The default interface will display the replication health report like
579       the following. In this example the log file is enabled. A sample
580       startup command is shown below:
581
582           shell> mysqlfailover --master=root@localhost:3331 --discover-slaves-login=root --log=log.txt
583           MySQL Replication Monitor and Failover Utility
584           Failover Mode = auto     Next Interval = Mon Mar 19 15:56:03 2012
585           Master Information
586           ------------------
587           Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
588           mysql-bin.000001  571
589           GTID Executed Set
590           2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7 [...]
591           Replication Health Status
592           +------------+-------+---------+--------+------------+---------+
593           | host       | port  | role    | state  | gtid_mode  | health  |
594           +------------+-------+---------+--------+------------+---------+
595           | localhost  | 3331  | MASTER  | UP     | ON         | OK      |
596           | localhost  | 3332  | SLAVE   | UP     | ON         | OK      |
597           | localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
598           | localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
599           +------------+-------+---------+--------+------------+---------+
600           Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries
601
602       Press Q to exit the utility, R to refresh the current display, and H
603       returns to the replication health report.
604
605       Press G key to show a GTID report similar to the following. The first
606       page shown is the master's executed GTID set:
607
608           MySQL Replication Monitor and Failover Utility
609           Failover Mode = auto     Next Interval = Mon Mar 19 15:59:33 2012
610           Master Information
611           ------------------
612           Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
613           mysql-bin.000001  571
614           GTID Executed Set
615           2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7 [...]
616           Master GTID Executed Set
617           +-------------------------------------------+
618           | gtid                                      |
619           +-------------------------------------------+
620           | 2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7  |
621           | 5503D37E-2DB2-11E2-A781-8077D4C14B33:1-3  |
622           +-------------------------------------------+
623           Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries Up|Down-scroll
624
625       Continuing to press G key cycles through the three GTID lists.
626
627       If the list is longer than the screen permits as shown in the example
628       above, the scroll up and down help is also shown. In this case, press
629       the down arrow key to scroll down.
630
631       Press U to view the list of UUIDs used in the topology, for example:
632
633           MySQL Replication Monitor and Failover Utility
634           Failover Mode = auto     Next Interval = Mon Mar 19 16:02:34 2012
635           Master Information
636           ------------------
637           Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
638           mysql-bin.000001  571
639           GTID Executed Set
640           2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7 [...]
641           UUIDs
642           +------------+-------+---------+---------------------------------------+
643           | host       | port  | role    | uuid                                  |
644           +------------+-------+---------+---------------------------------------+
645           | localhost  | 3331  | MASTER  | 55c65a00-71fd-11e1-9f80-ac64ef85c961  |
646           | localhost  | 3332  | SLAVE   | 5dd30888-71fd-11e1-9f80-dc242138b7ec  |
647           | localhost  | 3333  | SLAVE   | 65ccbb38-71fd-11e1-9f80-bda8146bdb0a  |
648           | localhost  | 3334  | SLAVE   | 6dd6abf4-71fd-11e1-9f80-d406a0117519  |
649           +------------+-------+---------+---------------------------------------+
650           Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries
651
652       If, once the master is detected as down and failover mode is auto or
653       elect and there are viable candidate slaves, the failover feature will
654       engage automatically and the user will see the failover messages
655       appear. When failover is complete, the interface returns to monitoring
656       replication health after 5 seconds. The following shows an example of
657       failover occurring.:
658
659           Failover starting...
660           # Candidate slave localhost:3332 will become the new master.
661           # Preparing candidate for failover.
662           # Creating replication user if it does not exist.
663           # Stopping slaves.
664           # Performing STOP on all slaves.
665           # Switching slaves to new master.
666           # Starting slaves.
667           # Performing START on all slaves.
668           # Checking slaves for errors.
669           # Failover complete.
670           # Discovering slaves for master at localhost:3332
671           Failover console will restart in 5 seconds.
672
673       After the failover event, the new topology is shown in the replication
674       health report.:
675
676           MySQL Replication Monitor and Failover Utility
677           Failover Mode = auto     Next Interval = Mon Mar 19 16:05:12 2012
678           Master Information
679           ------------------
680           Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
681           mysql-bin.000001  1117
682           GTID Executed Set
683           2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7 [...]
684           UUIDs
685           +------------+-------+---------+--------+------------+---------+
686           | host       | port  | role    | state  | gtid_mode  | health  |
687           +------------+-------+---------+--------+------------+---------+
688           | localhost  | 3332  | MASTER  | UP     | ON         | OK      |
689           | localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
690           | localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
691           +------------+-------+---------+--------+------------+---------+
692           Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries
693
694       Pressing L with the --log option specified causes the interface to show
695       the entries in the log file, such as:
696
697           MySQL Replication Monitor and Failover Utility
698           Failover Mode = auto     Next Interval = Mon Mar 19 16:06:13 2012
699           Master Information
700           ------------------
701           Binary Log File   Position  Binlog_Do_DB  Binlog_Ignore_DB
702           mysql-bin.000001  1117
703           GTID Executed Set
704           2A67DE00-2DA1-11E2-A711-00764F2BE90F:1-7 [...]
705           Log File
706           +-------------------------+----------------------------------------- ... --+
707           | Date                    | Entry                                    ...   |
708           +-------------------------+----------------------------------------- ... --+
709           | 2012-03-19 15:55:33 PM  | INFO Failover console started.           ...   |
710           | 2012-03-19 15:55:33 PM  | INFO Failover mode = auto.               ...   |
711           | 2012-03-19 15:55:33 PM  | INFO Getting health for master: localhos ...   |
712           | 2012-03-19 15:55:33 PM  | INFO Master status: binlog: mysql-bin.00 ...   |
713           +-------------------------+----------------------------------------- ... --+
714           Q-quit R-refresh H-health G-GTID Lists U-UUIDs L-log entries Up|Down-scroll\
715
716       PERMISSIONS REQUIRED.PP The user must have permissions to monitor the
717       servers on the topology and configure replication to successfully
718       perform the failover operation. Additional permissions are also
719       required to register and unregister the running mysqlfailover instance
720       on the master and slaves. Specifically, the login user must have the
721       following privileges: SUPER, GRANT OPTION, REPLICATION SLAVE, RELOAD,
722       DROP, CREATE, INSERT, and SELECT.
723
724       The referred permissions are required for the login users used for all
725       servers (master, slaves and candidates).
726
728       Copyright © 2006, 2015, Oracle and/or its affiliates. All rights
729       reserved.
730
731       This documentation is free software; you can redistribute it and/or
732       modify it only under the terms of the GNU General Public License as
733       published by the Free Software Foundation; version 2 of the License.
734
735       This documentation is distributed in the hope that it will be useful,
736       but WITHOUT ANY WARRANTY; without even the implied warranty of
737       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
738       General Public License for more details.
739
740       You should have received a copy of the GNU General Public License along
741       with the program; if not, write to the Free Software Foundation, Inc.,
742       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
743       http://www.gnu.org/licenses/.
744
745

NOTES

747        1. Replication with Global Transaction Identifiers
748           http://dev.mysql.com/doc/refman/5.6/en/replication-gtids.html
749

SEE ALSO

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

AUTHOR

756       Oracle Corporation (http://dev.mysql.com/).
757
758
759
760MySQL 1.5.6                       09/15/2015                  MYSQLFAILOVER(1)
Impressum