Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 38.5Mb
PDF (A4) - 38.5Mb
PDF (RPM) - 33.3Mb
HTML Download (TGZ) - 8.1Mb
HTML Download (Zip) - 8.2Mb
HTML Download (RPM) - 7.0Mb
Man Pages (TGZ) - 134.3Kb
Man Pages (Zip) - 190.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Setting the Replication Master Configuration

17.1.2.1 Setting the Replication Master Configuration

To configure a master to use binary log file position based replication, you must ensure that binary logging is enabled, and establish a unique server ID. If this has not already been done, a server restart is required.

Binary logging is required on the master because the binary log is the basis for replicating changes from the master to its slaves. Binary logging is enabled by default (the log_bin system variable is set to ON). The --log-bin option tells the server what base name to use for binary log files. It is recommended that you specify this option to give the binary log files a non-default base name, so that if the host name changes, you can easily continue to use the same binary log file names (see Section B.5.7, “Known Issues in MySQL”).

Each server within a replication topology must be configured with a unique server ID, which you can specify using the --server-id option. This server ID is used to identify individual servers within the replication topology, and must be a positive integer between 1 and (232)−1. If you set a server ID of 0 on a master, it refuses any connections from slaves, and if you set a server ID of 0 on a slave, it refuses to connect to a master. Other than that, how you organize and select the numbers is your choice, so long as each server ID is different from every other server ID in use by any other server in the replication topology. The server_id system variable is set to 1 by default. A server can be started with this default server ID, but an informational message is issued if you did not specify a server ID explicitly.

Note

The following options also have an impact on the replication master:

  • For the greatest possible durability and consistency in a replication setup using InnoDB with transactions, you should use innodb_flush_log_at_trx_commit=1 and sync_binlog=1 in the replication master's my.cnf file.

  • Ensure that the skip-networking option is not enabled on the replication master. If networking has been disabled, the slave cannot communicate with the master and replication fails.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by Yannick Warnier on February 24, 2011
On some systems (like Debian/Ubuntu), the skip-networking setting has been replaced by setting bind-address to 127.0.0.1.
To allow for a slave, you will have to make sure that the slave's address or hostname is matched by the bind-address setting. See http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_bind-address for bind-address details.
Sign Up Login You must be logged in to post a comment.