Mysql delayed replication setup

Posted By : Ankit Arora | 29-Mar-2017

Mysql delayed replication setup.

Before setting up delayed replication you need to setup Master-Slave replication first.
Setting up mysql replication :- https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

Note: Mysql-server-5.6 has delayed replication feature.

Follow these steps to add delay in replication:-

 

Step 1:

Login to Slave server as a root user.

$ mysql -u root -p


Step 2:

Stop Slave server:

> STOP SLAVE;


Step 3:

Now setting delay time for replication:

> CHANGE MASTER TO MASTER_DELAY = 1200;

Time set is 1200 seconds.


Step 4:

Now starting the mysql slave server:

START SLAVE;


Step 5:

Checking Slave Status:

SHOW SLAVE STATUS G;


All done!

ADVANTAGES:

To avoid conditions like accidental deletion or updation of DB or tables.

 

TO RESET BACK TO ZERO or PREVIOUS DELAY SETTING:

Login as root & run the following command:

RESET SLAVE;

 

THANKS

About Author

Author Image
Ankit Arora

Ankit is a Redhat Certified Engineer and Cloud Engineer.

Request for Proposal

Name is required

Comment is required

Sending message..