- 126.96.36.199 Setting the Replication Source Configuration
- 188.8.131.52 Setting the Replica Configuration
- 184.108.40.206 Creating a User for Replication
- 220.127.116.11 Obtaining the Replication Source Binary Log Coordinates
- 18.104.22.168 Creating a Data Snapshot Using mysqldump
- 22.214.171.124 Creating a Data Snapshot Using Raw Data Files
- 126.96.36.199 Setting Up Replication with New Source and Replicas
- 188.8.131.52 Setting Up Replication with Existing Data
- 184.108.40.206 Introducing Additional Replicas to an Existing Replication Environment
- 220.127.116.11 Setting the Source Configuration on the Replica
This section describes how to set up complete replication of a MySQL server. There are a number of different methods for setting up replication, and the exact method to use depends on how you are setting up replication, and whether you already have data within your source database.
There are some generic tasks that are common to all replication setups:
On the source, you must enable binary logging and configure a unique server ID. This might require a server restart. See Section 18.104.22.168, “Setting the Replication Source Configuration”.
On each replica that you want to connect to the source, you must configure a unique server ID. This might require a server restart. See Section 22.214.171.124, “Setting the Replica Configuration”.
Optionally, create a separate user for your replicas to use during authentication with the source when reading the binary log for replication. See Section 126.96.36.199, “Creating a User for Replication”.
Before creating a data snapshot or starting the replication process, you should record the position of the binary log on the source. You will need this information when configuring the replica so that the replica knows where within the binary log to start executing events. See Section 188.8.131.52, “Obtaining the Replication Source Binary Log Coordinates”.
If you already have data on your source and want to use it to synchronize your replica, you need to create a data snapshot. There are different methods to create the database snapshot, depending on the size of the database and the location of the files. Create a snapshot using mysqldump (see Section 184.108.40.206, “Creating a Data Snapshot Using mysqldump”) or by copying the data files directly (see Section 220.127.116.11, “Creating a Data Snapshot Using Raw Data Files”).
Configure the replica with settings for connecting to the source, such as the host name, login credentials, and binary log file name and position. See Section 18.104.22.168, “Setting the Source Configuration on the Replica”.
After configuring the basic options, select your scenario:
To set up replication for a fresh installation of a source and replicas that contain no data, see Section 22.214.171.124, “Setting Up Replication with New Source and Replicas”.
To set up replication of a new source using the data from an existing MySQL server, see Section 126.96.36.199, “Setting Up Replication with Existing Data”.
To add replicas to an existing replication environment, see Section 188.8.131.52, “Introducing Additional Replicas to an Existing Replication Environment”.
Before administering MySQL replication servers, read this entire chapter and try all statements mentioned in Section 13.4.1, “SQL Statements for Controlling Replication Source Servers”, and Section 13.4.2, “SQL Statements for Controlling Replica Servers”. Also familiarize yourself with the replication startup options described in Section 17.1.4, “Replication and Binary Logging Options and Variables”.
Certain steps within the setup process require the
SUPER privilege. If you do not
have this privilege, it might not be possible to enable