Guest User

Untitled

a guest
Nov 26th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. # We use --single-transaction instead of --lock-tables as it's working on a production database
  2. # Versions follow:
  3. # mysqldump Ver 10.13 Distrib 5.5.17, for Linux (x86_64)
  4. # mysql Ver 14.14 Distrib 5.5.17, for Linux (x86_64) using readline 5.1
  5. # mysqld Ver 5.5.17-55 for Linux on x86_64 (Percona Server (GPL), Release 22.1)
  6.  
  7. mysqldump -u XXX -pXXX --master-data=1 --single-transaction --flush-logs --all-databases
  8.  
  9. # and here's the script we use to restore the dump on the remote system
  10.  
  11. $MYSQL -e "STOP SLAVE"
  12. $MYSQL -e "RESET MASTER"
  13. $MYSQL -e "CHANGE MASTER TO MASTER_HOST='XXX', MASTER_USER='XXX', MASTER_PASSWORD='XXX'"
  14. (echo "SET SESSION sql_log_bin=0;"; zcat $LASTBACKUP) | time $MYSQL
  15. $MYSQL -e "START SLAVE"
  16.  
  17. # problem symptom is that we're getting duplicate entries straight after the slave is started.
  18. # manually removing the entries (usually a few seconds worth) sets the slave going properly again,
  19. # but isn't a long term solution.
  20.  
  21. # I'm looking at bringing in Percona Xtrabackup, but right now we're not on file-per-table and as
  22. # such the backup is about 4x the size. I'd also need to rewrite these scripts, so I'm hoping there's
  23. # something simple in the above that I can fix first.
Add Comment
Please, Sign In to add comment