useful:mysql-replication
Differences
This shows you the differences between two versions of the page.
useful:mysql-replication [2022/08/13 06:47] – created admin | useful:mysql-replication [2022/11/26 08:43] (current) – admin | ||
---|---|---|---|
Line 13: | Line 13: | ||
The master server is now effectively stopped. Make a note of the information on the master’s status and then go to the master’s command line and run: | The master server is now effectively stopped. Make a note of the information on the master’s status and then go to the master’s command line and run: | ||
- | mysqldump -u root -p --replace --opt --all-databases > backup-YYY-MM-YY.sql | + | mysqldump -u root -p --single-transaction |
Note that the option –replace is important, and is often not mentioned in instructions for resync. What it does is avoid conflicts that can arise with MyISAM tables, resulting in a failure of the restore because of duplicate keys. With the –replace option, later inserts will overwrite earlier ones. | Note that the option –replace is important, and is often not mentioned in instructions for resync. What it does is avoid conflicts that can arise with MyISAM tables, resulting in a failure of the restore because of duplicate keys. With the –replace option, later inserts will overwrite earlier ones. | ||
+ | |||
+ | If you are running as root and the database server is MariaDB, there is no need to specify user and password, so the command can be: | ||
+ | |||
+ | | ||
+ | |||
+ | I find that this is liable to hang, and currently have no solution for it, except perhaps to rely on being able to unlock when the back has stalled - see next paragraph. | ||
People say the next command on the master’s SQL session can be done as soon as the mysqldump is started, although I have had problems doing that and I usually wait for it to complete just to be certain nothing is out of line: | People say the next command on the master’s SQL session can be done as soon as the mysqldump is started, although I have had problems doing that and I usually wait for it to complete just to be certain nothing is out of line: |
useful/mysql-replication.1660373237.txt.gz · Last modified: 2022/08/13 06:47 by admin