SQL Statements for Controlling Slave Servers
1128
case, the old values for the master binary log file name and position are considered no longer
applicable, so if you do not specify
MASTER_LOG_FILE
and
MASTER_LOG_POS
in the statement,
MASTER_LOG_FILE=''
and
MASTER_LOG_POS=4
are silently appended to it.
Setting
MASTER_HOST=''
—that is, setting its value explicitly to an empty string—is not the same as
not setting it at all. Setting this option to an empty string causes
START SLAVE
subsequently to fail.
(Bug #28796)
•
MASTER_USER
and
MASTER_PASSWORD
are the user name and password of the account to use for
connecting to the master.
Currently, a password used for a replication slave account is effectively limited to 32 characters in
length; the password can be longer, but any excess characters are truncated. This is not due to any
limit imposed by the MySQL Server generally, but rather is an issue specific to MySQL Replication.
(For more information, see Bug #43439.)
The text of a running
CHANGE MASTER TO
statement, including values for
MASTER_USER
and
MASTER_PASSWORD
, can be seen in the output of a concurrent
SHOW PROCESSLIST
statement.
The
MASTER_SSL_xxx
options provide information about using SSL for the connection. They
correspond to the
--ssl-xxx
options described in
Section 6.3.6.4, “SSL Command Options”
, and
Section 16.3.7, “Setting Up Replication Using SSL”
. These options can be changed even on slaves
that are compiled without SSL support. They are saved to the
master.info
file, but are ignored if the
slave does not have SSL support enabled.
MASTER_CONNECT_RETRY
specifies how many seconds to wait between connect retries. The default
is 60. The number of reconnection attempts is limited by the
--master-retry-count
[1454]
server option; for more information, see
Section 16.1.2, “Replication and Binary Logging Options and
Variables”
.
MASTER_LOG_FILE
and
MASTER_LOG_POS
are the coordinates at which the slave I/O thread
should begin reading from the master the next time the thread starts.
RELAY_LOG_FILE
and
RELAY_LOG_POS
are the coordinates at which the slave SQL thread should begin reading
from the relay log the next time the thread starts. If you specify either of
MASTER_LOG_FILE
or
MASTER_LOG_POS
, you cannot specify
RELAY_LOG_FILE
or
RELAY_LOG_POS
. If neither of
MASTER_LOG_FILE
or
MASTER_LOG_POS
is specified, the slave uses the last coordinates of the slave
SQL thread before
CHANGE MASTER TO
was issued. This ensures that there is no discontinuity in
replication, even if the slave SQL thread was late compared to the slave I/O thread, when you merely
want to change, say, the password to use.
CHANGE MASTER TO
deletes all relay log files and starts a new one, unless you specify
RELAY_LOG_FILE
or
RELAY_LOG_POS
. In that case, relay log files are kept; the
relay_log_purge
[489]
global variable is set silently to 0.
CHANGE MASTER TO
is useful for setting up a slave when you have the snapshot of the master and
have recorded the master binary log coordinates corresponding to the time of the snapshot. After
loading the snapshot into the slave to synchronize it to the slave, you can run
CHANGE MASTER
TO MASTER_LOG_FILE='log_name', MASTER_LOG_POS=log_pos
on the slave to specify the
coordinates at which the slave should begin reading the master binary log.
The following example changes the master server the slave uses and establishes the master binary
log coordinates from which the slave begins reading. This is used when you want to set up the slave to
replicate the master:
CHANGE MASTER TO
MASTER_HOST='master2.mycompany.com',
MASTER_USER='replication',
MASTER_PASSWORD='bigs3cret',
MASTER_PORT=3306,
MASTER_LOG_FILE='master2-bin.001',
MASTER_LOG_POS=4,
MASTER_CONNECT_RETRY=10;
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...