statements with SET sql_log_bin = 0  before them and SET sql_log_bin = 1  after them, so that they are not logged on the source. 

6. If the transaction is a DDL or DML statement that should not have taken place on either the source or the replica, skip the transaction on the server or servers where it stopped replication, undo the transaction manually on the server where it originally took place, then issue START REPLICA | SLAVE  to restart replication. 

To skip a transaction, if GTIDs are in use, commit an empty transaction that has the GTID of the failing transaction, for example: 

SET GTID_NEXT=’aaa-bbb-ccc-ddd:N’; BEGIN; COMMIT; SET GTID_NEXT=’AUTOMATIC’; 

If GTIDs are not in use, issue a SET GLOBAL sql_slave_skip_counter  statement to skip the event. For instructions to use this alternative method and more details about skipping transactions, see Section 17.1.7.3, “Skipping Transactions” . 

## 17.4 Replication Solutions 

Replication can be used in many different environments for a range of purposes. This section provides general notes and advice on using replication for specific solution types. 

For information on using replication in a backup environment, including notes on the setup, backup procedure, and files to back up, see Section 17.4.1, “Using Replication for Backups” . 

For advice and tips on using different storage engines on the source and replica, see Section 17.4.4, “Using Replication with Different Source and Replica Storage Engines” . 

Using replication as a scale-out solution requires some changes in the logic and operation of applications that use the solution. See Section 17.4.5, “Using Replication for Scale-Out” . 

For performance or data distribution reasons, you may want to replicate different databases to different replicas. See Section 17.4.6, “Replicating Different Databases to Different Replicas” 

As the number of replicas increases, the load on the source can increase and lead to reduced performance (because of the need to replicate the binary log to each replica). For tips on improving your replication performance, including using a single secondary server as the source, see Section 17.4.7, “Improving Replication Performance” . 

For guidance on switching sources, or converting replicas into sources as part of an emergency failover solution, see Section 17.4.8, “Switching Sources During Failover” . 

For information on security measures specific to servers in a replication topology, see Section 17.3, “Replication Security” . 

## 17.4.1 Using Replication for Backups 

To use replication as a backup solution, replicate data from the source to a replica, and then back up the replica. The replica can be paused and shut down without affecting the running operation of the source, so you can produce an effective snapshot of “live”  data that would otherwise require the source to be shut down. 

How you back up a database depends on its size and whether you are backing up only the data, or the data and the replica state so that you can rebuild the replica in the event of failure. There are therefore two choices: 

