Comments - Setting Up Replication

3 months ago Ed Greenberg

Now you need prevent any changes to the data while you view the binary log position. You'll use this to tell the slave at exactly which point it should start replicating from.

On the master, flush and lock all tables by running FLUSH TABLES WITH READ LOCK. Keep this session running - exiting it will release the lock. Get the current position in the binary log by running SHOW MASTER STATUS:

Don't forget to check and possibly set two variables:

show variables like 'wait_timeout';
show variables like 'interactive_timeout';
set variables interactive_timeout=XXX;
set variables work_timeout=XXX;

The defaults for these are very large, at 28,800 seconds, but many installations set them smaller. Mine were 300 seconds, so my locks timed out and I had to do the database dump again.

I know that my dump takes 42 minutes, so I set them for 3600 seconds, or one hour. Your mileage may vary :)

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.