1. Acquire a read lock and get the source’s status. See Section 17.1.2.4, “Obtaining the Replication Source Binary Log Coordinates” . 

2. Make a copy of the MySQL data files. The following examples show common ways to do this. You need to choose only one of them: 

shell> tar cf /tmp/db.tar ./data shell> zip -r /tmp/db.zip ./data shell> rsync --recursive ./data /tmp/dbdata 

3. In the client where you acquired the read lock, release the lock: 

mysql> UNLOCK TABLES; 

Once you have created the archive or copy of the database, copy the files to each replica before starting the replication process. 

## 17.1.2.6 Setting Up Replicas 

The following sections describe how to set up replicas. Before you proceed, ensure that you have: 

•Configured the source with the necessary configuration properties. See Section 17.1.2.1, “Setting the Replication Source Configuration” . 

•Obtained the source status information, or a copy of the source’s binary log index file made during a shutdown for the data snapshot. See Section 17.1.2.4, “Obtaining the Replication Source Binary Log Coordinates” . 

•On the source, released the read lock: 

mysql> UNLOCK TABLES; 

•On the replica, edited the MySQL configuration. See Section 17.1.2.2, “Setting the Replica Configuration” . 

The next steps depend on whether you have existing data to import to the replica or not. See Section 17.1.2.5, “Choosing a Method for Data Snapshots”  for more information. Choose one of the following: 

•If you do not have a snapshot of a database to import, see Setting Up Replication with New Source and Replicas. 

•If you have a snapshot of a database to import, see Setting Up Replication with Existing Data. 

## Setting Up Replication with New Source and Replicas 

When there is no snapshot of a previous database to import, configure the replica to start replication from the new source. 

To set up replication between a source and a new replica: 

1. Start up the replica. 

2. Execute a CHANGE REPLICATION SOURCE TO  | CHANGE MASTER TO  statement on the replica to set the source configuration. See Section 17.1.2.7, “Setting the Source Configuration on the Replica” . 

Perform these replica setup steps on each replica. 

