Rechercher dans le manuel MySQL
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.4.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.
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 useinnodb_flush_log_at_trx_commit=1
andsync_binlog=1
in the replication master'smy.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.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-replication-howto-masterbaseconfig.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.