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
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Ankit Arora
Ankit is a Redhat Certified Engineer and Cloud Engineer.