'\" t .\" Title: \fBmysqlrpladmin\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 08/01/2016 .\" Manual: MySQL Utilities .\" Source: MySQL 1.6.3 .\" Language: English .\" .TH "\FBMYSQLRPLADMIN\FR" "1" "08/01/2016" "MySQL 1\&.6\&.3" "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 * .\" ----------------------------------------------------------------- .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 single 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 to the slaves\&. .PP 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 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 \fB\-\-report\-host\fR and \fB\-\-report\-port\fR 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 \*(Aqdiscover slaves\*(Aq feature ignores any slaves it cannot connect to, or if the IO thread stopped (it is 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 filename 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\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP The option to pass in \-\-slaves without also passing in \-\-master was added in MySQL Utilities 1\&.6\&.0\&. .sp .5v .RE .PP Use the \fB\-\-verbose\fR option to see additional information in the health report and additional messages during switchover or failover\&. COMMANDS.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 slave election and report the candidate slave to use in the event a switchover or failover is required\&. 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 can be run with the following combination of options: .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 .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB\-\-slaves\fR .RE .sp .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP The health column will display "no master specified" when generating a health report for a collection of slaves and no \fB\-\-master\fR option specified\&. .sp .5v .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 (replication is 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 (replication is 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 (replication is 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 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 .\} \-\-license .sp Display license information and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-candidates= .sp Connection information for candidate slave servers for failover\&. Valid only with failover command\&. List multiple slaves in comma\-separated list\&. .sp To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use login\-paths from your \&.mylogin\&.cnf file (encrypted, not visible)\&. Example : <\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 .\} Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example : <\fIconfiguration\-file\-path\fR>[:<\fIsection\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Specify the data on the command\-line (unencrypted, visible)\&. Example : <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .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= .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=