1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
|
'\" t
.\" Title: \fBmysqlrpladmin\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 08/30/2013
.\" Manual: MySQL Utilities
.\" Source: MySQL 1.3.4
.\" Language: English
.\"
.TH "\FBMYSQLRPLADMIN\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysqlrpladmin
.\" utilities: mysqlrpladmin
.\" scripts
.SH "NAME"
mysqlrpladmin \- Administration utility for MySQL replication
.SH "SYNOPSIS"
.HP \w'\fBmysqlrpladmin\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
\fBmysqlrpladmin [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.PP
This utility permits users to perform administrative actions on a replication topology consisting of a master and its slaves\&. The utility is designed to make it easy to recover from planned maintenance of the master or from an event that takes the master offline unexpectedly\&.
.PP
The act of taking the master offline intentionally and switching control to another slave is called switchover\&. In this case, there is no loss of transactions as the master is locked and all slaves are allowed to catch up to the master\&. Once the slaves have read all events from the master, the master is shutdown and control switched to a slave (in this case called a candidate slave)\&.
.PP
Recovering from the loss of a downed master is more traumatic and since there is no way to know what transactions the master may have failed to send, the new master (called a candidate slave) must be the slave that is most up\-to\-date\&. How this is determined depends on the version of the server (see below)\&. However, it can result in the loss of some transactions that were executed on the downed master but not sent\&. The utility accepts a list of slaves to be considered the candidate slave\&. If no slave is found to meet the requirements, the operation will search the list of known slaves\&.
.PP
The utility also provides a number of useful commands for managing a replication topology including the following\&.
.PP
\fBelect\fR
This command is available to only those servers supporting global transaction identifiers (GTIDs), perform best slave election and report best slave to use in the event a switchover or failover is required\&. Best slave election is simply the first slave to meet the prerequisites\&. GTIDs are supported in version 5\&.6\&.5 and higher\&. This command requires the options
\fB\-\-master\fR
and either
\fB\-\-slaves\fR
or
\fB\-\-discover\-slaves\-login\fR\&.
.PP
\fBfailover\fR
This command is available to only those servers supporting GTIDs\&. Conduct failover to the best slave\&. The command will test each candidate slave listed for the prerequisites\&. Once a candidate slave is elected, it is made a slave of each of the other slaves thereby collecting any transactions executed on other slaves but not the candidate\&. In this way, the candidate becomes the most up\-to\-date slave\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because, for failover, the master is presumed to be offline or otherwise unreachable (so there is no way to discover the slaves)\&. The
\fB\-\-master\fR
option is ignored for this command\&.
.PP
\fBgtid\fR
This command is available to only those servers supporting GTIDs\&. It displays the contents of the GTID variables, @@GLOBAL\&.GTID_EXECUTED, @@GLOBAL\&.GTID_PURGED, and @@GLOBAL\&.GTID_OWNED\&. The command also displays universally unique identifiers (UUIDs) for all servers\&. This command requires one of the following combinations:
\fB\-\-master\fR
and
\fB\-\-slaves\fR, or
\fB\-\-master\fR
and
\fB\-\-discover\-slaves\-login\fR\&.
.PP
\fBhealth\fR
Display the replication health of the topology\&. By default, this includes the host name, port, role (MASTER or SLAVE) of the server, state of the server (UP = is connected, WARN = not connected but can ping, DOWN = not connected and cannot ping), the GTID_MODE, and health state\&. This command requires one of the following combinations:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR
and
\fB\-\-slaves\fR;
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR
and
\fB\-\-discover\-slaves\-login\fR;
.RE
.PP
The master health state is based on the following; if GTID_MODE=ON, the server must have binary log enabled, and there must exist a user with the REPLICATE SLAVE privilege\&.
.PP
The slave health state is based on the following; the IO_THREAD and SQL_THREADS must be running, it must be connected to the master, there are no errors, the slave delay for non\-gtid enabled scenarios is not more than the threshold provided by the
\fB\-\-max\-position\fR
and the slave is reading the correct master log file, and slave delay is not more than the
\fB\-\-seconds\-behind\fR
threshold option\&.
.PP
\fBreset\fR
Execute the STOP SLAVE and RESET SLAVE commands on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility will perform an additional check to verify if the specified slaves are associated (i\&.e\&. replication configured) to the given master\&.
.PP
\fBstart\fR
Execute the START SLAVE command on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility will perform an additional check to verify if the specified slaves are associated (i\&.e\&. replication configured) to the given master\&.
.PP
\fBstop\fR
Execute the STOP SLAVE command on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility will perform an additional check to verify if the specified slaves are associated (i\&.e\&. replication configured) to the given master\&.
.PP
\fBswitchover\fR
Perform slave promotion to a specified candidate slave as designated by the
\fB\-\-new\-master\fR
option\&. This command is available for both gtid\-enabled servers and non\-gtid\-enabled scenarios\&. This command requires one of the following combinations:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR,
\fB\-\-new\-master\fR
and
\fB\-\-slaves\fR;
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR,
\fB\-\-new\-master\fR
and
\fB\-\-discover\-slaves\-login\fR;
.RE
.PP
Detection of a downed master is performed as follows\&. If the connection to the master is lost, wait
\fB\-\-ping\fR
seconds and check again\&. If the master connection is lost and the master cannot be pinged or reconnected, the failover event occurs\&.
.PP
For all commands that require specifying multiple servers, the options require a comma\-separated list of connection parameters in the following form (where the password, port, and socket are optional)\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
<*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>] or
<*login\-path*>[:<*port*>][:<*socket*>]
.fi
.if n \{\
.RE
.\}
.PP
The utility permits users to discover slaves connected to the master\&. In order to use the discover slaves feature, all slaves must use the \-\-report\-host and \-\-report\-port startup variables to specify the correct hostname and ip port of the slave\&. If these are missing or report the incorrect information, the slaves health may not be reported correctly or the slave may not be listed at all\&. The discover slaves feature ignores any slaves it cannot connect to or with the IO thread stopped (i\&.e\&. not connected to the master)\&.
.PP
The utility permits the user to demote a master to a slave during the switchover operation\&. The
\fB\-\-demote\-master\fR
option tells the utility to, once the new master is established, make the old master a slave of the new master\&. This permits rotation of the master role among a set of servers\&.
.PP
The utility permits the user to specify an external script to execute before and after the switchover and failover commands\&. The user can specify these with the
\fB\-\-exec\-before\fR
and
\fB\-\-exec\-after\fR
options\&. The return code of the script is used to determine success thus each script must report 0 (success) to be considered successful\&. If a script returns a value other than 0, the result code is presented in an error message\&.
.PP
The utility permits the user to log all actions taken during the commands\&. The
\fB\-\-log\fR
option requires a valid path and file name of the file to use for logging operations\&. The log is active only when this option is specified\&. The option
\fB\-\-log\-age\fR
specifies the age in days that log entries are kept\&. The default is seven (7) days\&. Older entries are automatically deleted from the log file (but only if the
\fB\-\-log\fR
option is specified)\&.
.PP
The format of the log file includes the date and time of the event, the level of the event (informational \- INFO, warning \- WARN, error \- ERROR, critical failure \- CRITICAL), and the message reported by the utility\&.
.PP
The utility has a number of options each explained in more detail below\&. Some of the options are specific to certain commands\&. Warning messages are issued whenever an option is used that does not apply to the command requested\&. A brief overview of each command and its options is presented in the following paragraphs\&.
.PP
The start, stop, and reset commands require the
\fB\-\-slaves\fR
option to list all of the slaves in the topology\&. Optionally, the
\fB\-\-master\fR
option can be specified for the utility to check if the specified slaves are associated to the given master before executing the command, making sure that the command is only applied to slaves connected to the right replication master\&.
.PP
The options required for the elect, health and gtid commands include the
\fB\-\-master\fR
option to specify the existing master, and either the
\fB\-\-slaves\fR
option to list all of the slaves in the topology or the
\fB\-\-discover\-slaves\-login\fR
option to provide the user name and password to discover any slaves in the topology that are registered and connected to the master\&.
.PP
The options required for switchover include the
\fB\-\-master\fR
option to specify the existing master, the
\fB\-\-new\-master\fR
option to specify the candidate slave (the slave to become the new master), and either the
\fB\-\-slaves\fR
option to list the considered slaves in the topology or the
\fB\-\-discover\-slaves\-login\fR
option to provide the user name and password to discover any slaves in the topology that are registered and connected to the master\&.
.PP
The failover command requires only the
\fB\-\-slaves\fR
option to explicitly list all of the slaves in the topology because it is expected that the master is down when this command is used\&.
.PP
Use the
\fB\-\-verbose\fR
option to see additional information in the health report and additional messages during switchover or failover\&.
OPTIONS
.PP
\fBmysqlrpladmin\fR
accepts the following command\-line options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-candidates=<candidate slave connections>
.sp
Connection information for candidate slave servers for failover in the form: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&. Valid only with failover command\&. List multiple slaves in comma\-separated list\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-demote\-master
.sp
Make master a slave after switchover\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-discover\-slaves\-login=<slave_login>
.sp
At startup, query master for all registered slaves and use the user name and password specified to connect\&. Supply the user and password in the form <\fIuser\fR>[:<\fIpasswd\fR>] or <\fIlogin\-path\fR>\&. For example, \-\-discover=joe:secret will use \*(Aqjoe\*(Aq as the user and \*(Aqsecret\*(Aq as the password for each discovered slave\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-exec\-after=<script>
.sp
Name of script to execute after failover or switchover\&. Script name may include the path\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-exec\-before=<script>
.sp
Name of script to execute before failover or switchover\&. Script name may include the path\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-force
.sp
Ignore prerequisite checks or any inconsistencies found (e\&.g\&. errant transactions on the slaves or SQL thread errors) forcing the execution of the specified command\&. This option need to be used carefully as it will not solve any detected issue, but will only ignore them displaying a warning message\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-format=<format>, \-f <format>
.sp
Display the replication health output in either grid (default), tab, csv, or vertical format\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-log=<log_file>
.sp
Specify a log file to use for logging messages
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-log\-age=<days>
.sp
Specify maximum age of log entries in days\&. Entries older than this will be purged on startup\&. Default = 7 days\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-master=<connection>
.sp
Connection information for the master server in the format: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-max\-position=<position>
.sp
Used to detect slave delay\&. The maximum difference between the master\*(Aqs log position and the slave\*(Aqs reported read position of the master\&. A value greater than this means the slave is too far behind the master\&. Default = 0\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-new\-master=<connection>
.sp
Connection information for the slave to be used to replace the master for switchover in the form: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&. Valid only with switchover command\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-no\-health
.sp
Turn off health report after switchover or failover\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ping=<number>
.sp
Number of ping attempts for detecting downed server\&. Note: on some platforms this is the same as number of seconds to wait for
\fIping\fR
to return\&. This value is also used to check down status of master\&. Failover will wait
\fIping\fR
seconds to check master response\&. If no response, failover event occurs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-quiet, \-q
.sp
Turn off all messages for quiet execution\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-rpl\-user=<replication_user>
.sp
The user and password for the replication user requirement, in the format: <\fIuser\fR>[:<\fIpassword\fR>] or <\fIlogin\-path\fR>\&. E\&.g\&. rpl:passwd Default = None\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-script\-threshold=<return_code>
.sp
Value for external scripts to trigger aborting the operation if result is greater than or equal to the threshold\&.
.sp
Default = None (no threshold checking)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-seconds\-behind=<seconds>
.sp
Used to detect slave delay\&. The maximum number of seconds behind the master permitted before slave is considered behind the master\&. Default = 0\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-slaves=<slave connections>
.sp
Connection information for slave servers in the form: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&. List multiple slaves in comma\-separated list\&. The list will be evaluated literally whereby each server is considered a slave to the master listed regardless if they are a slave of the master\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-timeout=<seconds>
.sp
Maximum timeout in seconds to wait for each replication command to complete\&. For example, timeout for slave waiting to catch up to master\&. Default = 300 seconds\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
Display version information and exit\&.
.RE
NOTES
.PP
The login user must have the appropriate permissions to execute
\fBSHOW SLAVE STATUS\fR,
\fBSHOW MASTER STATUS\fR, and
\fBSHOW VARIABLES\fR
on the appropriate servers as well as grant the REPLICATE SLAVE privilege\&. The utility checks permissions for the master, slaves, and candidates at startup\&.
.PP
Mixing IP and hostnames is not recommended\&. The replication\-specific utilities will attempt to compare hostnames and IP addresses as aliases for checking slave connectivity to the master\&. However, if your installation does not support reverse name lookup, the comparison could fail\&. Without the ability to do a reverse name lookup, the replication utilities could report a false negative that the slave is (not) connected to the master\&.
.PP
For example, if you setup replication using MASTER_HOST=ubuntu\&.net on the slave and later connect to the slave with mysqlrplcheck and have the master specified as \-\-master=192\&.168\&.0\&.6 using the valid IP address for ubuntu\&.net, you must have the ability to do a reverse name lookup to compare the IP (192\&.168\&.0\&.6) and the hostname (ubuntu\&.net) to determine if they are the same machine\&.
.PP
Similarly, if you use localhost to connect to the master, the health report may not show all of the slaves\&. It is best to use the actual hostname of the master when connecting or setting up replication\&.
.PP
If the user does not specify the
\fB\-\-rpl\-user \fR
and the user has specified the switchover or failover command, the utility will check to see if the slaves are using \-\-master\-info\-repository=TABLE\&. If they are not, the utility will stop with an error\&.
.PP
All the commands require either the
\fB\-\-slaves\fR
or
\fB\-\-discover\-slaves\-login\fR
option but both cannot be used at the same time\&. In fact, some commands only allow the use of the
\fB\-\-slaves\fR
option which is safer to specify the list slaves, because
\fB\-\-discover\-slaves\-login\fR
might not provide an up to date list of available slaves\&.
.PP
The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the my_print_defaults tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&.
EXAMPLES
.PP
To perform best slave election for a topology with GTID_MODE=ON (server version 5\&.6\&.5 or higher) where all slaves are specified with the
\fB\-\-slaves\fR
option, run the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3331 \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 elect
# Electing candidate slave from known slaves\&.
# Best slave found is located on localhost:3332\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform best slave election supplying a candidate list, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3331 \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e
\-\-candidates=root@localhost:3333,root@localhost:3334 elect
# Electing candidate slave from candidate list then slaves list\&.
# Best slave found is located on localhost:3332\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform failover after a master has failed, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e
\-\-candidates=root@localhost:3333,root@localhost:3334 failover
# Performing failover\&.
# Candidate slave localhost:3333 will become the new master\&.
# Preparing candidate for failover\&.
# Creating replication user if it does not exist\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Switching slaves to new master\&.
# Starting slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Failover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To see the replication health of a topology with GTID_MODE=ON (server version 5\&.6\&.5 or higher) and discover all slaves attached to the master, run the following command\&. We use the result of the failover command above\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3333 \e
\-\-slaves=root@localhost:3332,root@localhost:3334 health
# Getting health for master: localhost:3333\&.
#
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host | port | role | state | gtid_mode | health |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost | 3333 | MASTER | UP | ON | OK |
| localhost | 3332 | SLAVE | UP | ON | OK |
| localhost | 3334 | SLAVE | UP | ON | OK |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To view a detailed replication health report but with all of the replication health checks revealed, use the
\fB\-\-verbose\fR
option as shown below\&. In this example, we use vertical format to make viewing easier\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3331 \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e
\-\-verbose health
# Getting health for master: localhost:3331\&.
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
#
# Replication Topology Health:
************************* 1\&. row *************************
host: localhost
port: 3331
role: MASTER
state: UP
gtid_mode: ON
health: OK
version: 5\&.6\&.5\-m8\-debug\-log
master_log_file: mysql\-bin\&.000001
master_log_pos: 571
IO_Thread:
SQL_Thread:
Secs_Behind:
Remaining_Delay:
IO_Error_Num:
IO_Error:
************************* 2\&. row *************************
host: localhost
port: 3332
role: SLAVE
state: UP
gtid_mode: ON
health: OK
version: 5\&.6\&.5\-m8\-debug\-log
master_log_file: mysql\-bin\&.000001
master_log_pos: 571
IO_Thread: Yes
SQL_Thread: Yes
Secs_Behind: 0
Remaining_Delay: No
IO_Error_Num: 0
IO_Error:
************************* 3\&. row *************************
host: localhost
port: 3333
role: SLAVE
state: UP
gtid_mode: ON
health: OK
version: 5\&.6\&.5\-m8\-debug\-log
master_log_file: mysql\-bin\&.000001
master_log_pos: 571
IO_Thread: Yes
SQL_Thread: Yes
Secs_Behind: 0
Remaining_Delay: No
IO_Error_Num: 0
IO_Error:
************************* 4\&. row *************************
host: localhost
port: 3334
role: SLAVE
state: UP
gtid_mode: ON
health: OK
version: 5\&.6\&.5\-m8\-debug\-log
master_log_file: mysql\-bin\&.000001
master_log_pos: 571
IO_Thread: Yes
SQL_Thread: Yes
Secs_Behind: 0
Remaining_Delay: No
IO_Error_Num: 0
IO_Error:
4 rows\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To run the same failover command above, but specify a log file, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e
\-\-candidates=root@localhost:3333,root@localhost:3334 \e
\-\-log=test_log\&.txt failover
# Performing failover\&.
# Candidate slave localhost:3333 will become the new master\&.
# Preparing candidate for failover\&.
# Creating replication user if it does not exist\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Switching slaves to new master\&.
# Starting slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Failover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
After this command, the log file will contain entries like the following:
.sp
.if n \{\
.RS 4
.\}
.nf
2012\-03\-19 14:44:17 PM INFO Executing failover command\&.\&.\&.
2012\-03\-19 14:44:17 PM INFO Performing failover\&.
2012\-03\-19 14:44:17 PM INFO Candidate slave localhost:3333 will become the new master\&.
2012\-03\-19 14:44:17 PM INFO Preparing candidate for failover\&.
2012\-03\-19 14:44:19 PM INFO Creating replication user if it does not exist\&.
2012\-03\-19 14:44:19 PM INFO Stopping slaves\&.
2012\-03\-19 14:44:19 PM INFO Performing STOP on all slaves\&.
2012\-03\-19 14:44:19 PM INFO Switching slaves to new master\&.
2012\-03\-19 14:44:20 PM INFO Starting slaves\&.
2012\-03\-19 14:44:20 PM INFO Performing START on all slaves\&.
2012\-03\-19 14:44:20 PM INFO Checking slaves for errors\&.
2012\-03\-19 14:44:21 PM INFO Failover complete\&.
2012\-03\-19 14:44:21 PM INFO \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform switchover and demote the current master to a slave, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3331 \e
\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e
\-\-new\-master=root@localhost:3332 \-\-demote\-master switchover
# Performing switchover from master at localhost:3331 to slave at localhost:3332\&.
# Checking candidate slave prerequisites\&.
# Waiting for slaves to catch up to old master\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Demoting old master to be a slave to the new master\&.
# Switching slaves to new master\&.
# Starting all slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Switchover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
If the replication health report is generated on the topology following the above command, it will display the old master as a slave as shown below\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host | port | role | state | gtid_mode | health |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost | 3332 | MASTER | UP | ON | OK |
| localhost | 3331 | SLAVE | UP | ON | OK |
| localhost | 3333 | SLAVE | UP | ON | OK |
| localhost | 3334 | SLAVE | UP | ON | OK |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
You can use the discover slaves feature, if and only if all slaves report their host and port to the master\&. A sample command to generate a replication health report with discovery is shown below\&. Note that the option
\fB\-\-discover\-slaves\-login\fR
cannot be used in conjunction with the
\fB\-\-slaves\fR
option\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
$ mysqlrpladmin \-\-master=root@localhost:3332 \-\-discover\-slaves\-login=root health
# Discovering slaves for master at localhost:3332
# Discovering slave at localhost:3331
# Found slave: localhost:3331
# Discovering slave at localhost:3333
# Found slave: localhost:3333
# Discovering slave at localhost:3334
# Found slave: localhost:3334
# Checking privileges\&.
#
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host | port | role | state | gtid_mode | health |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost | 3332 | MASTER | UP | ON | OK |
| localhost | 3331 | SLAVE | UP | ON | OK |
| localhost | 3333 | SLAVE | UP | ON | OK |
| localhost | 3334 | SLAVE | UP | ON | OK |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.SH "COPYRIGHT"
.br
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities section
of the MySQL Workbench Reference Manual, which is available online
at http://dev.mysql.com/doc/workbench/en/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
|