The next few sections contain information about mysqld options and server variables that are used in replication and for controlling the binary log. Options and variables for use on replication masters and replication slaves are covered separately, as are options and variables relating to binary logging. A set of quick-reference tables providing basic information about these options and variables is also included (in the next section following this one).
Of particular importance is the
|System Variable Name|
This option is common to both master and slave replication servers, and is used in replication to enable master and slave servers to identify themselves uniquely. For additional information, see Section 18.104.22.168, “Replication Master Options and Variables”, and Section 22.214.171.124, “Replication Slave Options and Variables”.
On the master and each slave, you must use the
--server-id option to establish a
unique replication ID in the range from 1 to
232 – 1. “Unique”,
means that each ID must be different from every other ID in use by
any other replication master or slave. Example:
In MySQL 5.7.2 and earlier, if you omit
--server-id, the default ID is 0, in
which case the master refuses connections from all slaves, and
slaves refuse to connect to the master, and the server sets the
server_id system variable to 1. In
MySQL 5.7.3 and later, the
--server-id must be used
if binary logging is enabled, and a value of 0 is not changed by the
server. (You can let the default be used by specifying
--server-id without an argument, but the effect is
the same as using 0.) In either case, if the
server_id is 0, binary logging takes place, but
the server cannot connect to any slaves as a master, nor can any
other servers connect to it as slaves. (Bug #11763963, Bug #56718)
For more information, see Section 126.96.36.199, “Setting the Replication Slave Configuration”.
|System Variable Name|
When starting, the MySQL server automatically obtains a UUID as follows:
auto.cnf file has a format similar to that
files. In MySQL 5.7,
only a single
[auto] section containing a single
server_uuid setting and value; the
file's contents appear similar to what is shown here:
auto.cnf file is automatically generated;
you should not attempt to write or modify this file.
When using MySQL replication, masters and slaves know one
another's UUIDs. The value of a slave's UUID can be seen
in the output of
SHOW SLAVE HOSTS.
START SLAVE has been executed
(but not before), the value of the master's UUID is available
on the slave in the output of
server_uuid is also used in GTIDs
for transactions originating on that server. For more information,
see Section 16.1.3, “Replication with Global Transaction Identifiers”.
When starting, the slave I/O thread generates an error and aborts if
its master's UUID is equal to its own unless the
--replicate-same-server-id option has
been set. In addition, the slave I/O thread generates a warning if
either of the following is true:
The addition of the
system variable in MySQL 5.7 does not change the
requirement for setting a unique
--server-id for each MySQL server
as part of preparing and running MySQL replication, as described
earlier in this section.
Copyright © 1997, 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices