.TH "MYSQLRPLADMIN" "1" "May 09, 2012" "1.0.3" "MySQL Utilities" .SH NAME mysqlrpladmin \- Administration utility for MySQL replication . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .\" Man page generated from reStructeredText. . .SH SYNOPSIS .sp .nf .ft C mysqlrpladmin [options] .ft P .fi .SH DESCRIPTION .sp 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. .sp 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). .sp 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. .sp The utility also provides a number of useful commands for managing a replication topology including the following. .sp \fBelect\fP 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. .sp \fBfailover\fP 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. .sp \fBgtid\fP This command is available to only those servers supporting GTIDs. It displays the contents of the GTID variables, @@GLOBAL.GTID_DONE, @@GLOBAL.GTID_LOST, and @@GLOBAL.GTID_OWNED. The command also displays universally unique identifiers (UUIDs) for all servers. .sp \fBhealth\fP 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. .sp 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. .sp 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 \fI\%--max-position\fP and the slave is reading the correct master log file, and slave delay is not more than the \fI\%--seconds-behind\fP threshold option. .sp \fBreset\fP Execute the STOP SLAVE and RESET SLAVE commands on all slaves. .sp \fBstart\fP Execute the START SLAVE command on all slaves. .sp \fBstop\fP Execute the STOP SLAVE command on all slaves. .sp \fBswitchover\fP Perform slave promotion to a specified candidate slave as designated by the \fI\%--new-master\fP option. This command is available for both gtid\-enabled servers and non\-gtid\-enabled scenarios. .sp Detection of a downed master is performed as follows. If the connection to the master is lost, wait \fI\%--timeout\fP seconds and check again. If the master connection is lost and the master cannot be pinged or reconnected, the failover event occurs. .sp 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 .nf .ft C <*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>], .ft P .fi .sp 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. .sp The utility permits the user to demote a master to a slave during the switchover operation. The \fI\%--demote-master\fP 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. .sp 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 \fI\%--exec-before\fP and \fI\%--exec-after\fP 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. .sp The utility permits the user to log all actions taken during the commands. The \fI\%--log\fP 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 \fI\%--log-age\fP 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 \fI\%--log\fP option is specified). .sp 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. .sp 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. .sp The elect, failover, start, stop, and reset commands require either the \fI\%--slaves\fP option to list all of the slaves in the topology or the \fI\%--discover-slaves-login\fP option to provide the user name and password to discover any slaves in the topology that are registered to the master but are not listed in the \fI\%--slaves\fP option. .sp The options required for the health and gtid commands include the \fI\-\-master\fP option to specify the existing master, and either the \fI\%--slaves\fP option to list all of the slaves in the topology or the \fI\%--discover-slaves-login\fP option to provide the user name and password to discover any slaves in the topology that are registered to the master but are not listed in the \fI\%--slaves\fP option. .sp Use the \fI\-\-verbose\fP option to see additional information in the health report and additional messages during switchover or failover. .sp The options required for switchover include the \fI\-\-master\fP option to specify the existing master, the \fI\%--new-master\fP option to specify the candidate slave (the slave to become the new master. .SH OPTIONS .sp \fBmysqlrpladmin\fP accepts the following command\-line options: .INDENT 0.0 .TP .B \-\-help Display a help message and exit. .UNINDENT .INDENT 0.0 .TP .B \-\-candidates= Connection information for candidate slave servers for failover in the form: <\fIuser\fP>[:<\fIpasswd\fP>]@<\fIhost\fP>[:<\fIport\fP>][:<\fIsocket\fP>]. Valid only with failover command. List multiple slaves in comma\- separated list. .UNINDENT .INDENT 0.0 .TP .B \-\-demote\-master Make master a slave after switchover. .UNINDENT .INDENT 0.0 .TP .B \-\-discover\-slaves\-login= 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\fP>[:<\fIpasswd\fP>]. For example, \-\-discover=joe:secret will use \(aqjoe\(aq as the user and \(aqsecret\(aq as the password for each discovered slave. .UNINDENT .INDENT 0.0 .TP .B \-\-exec\-after=