Saturday, September 15, 2018

MySQL backup and replication tools

MySQL backup and replication tools

mydumper

https://github.com/maxbube/mydumper

Percona XtraBackup

https://www.percona.com/software/mysql-database/percona-xtrabackup

Percona MySQL-AutoXtraBackup

https://github.com/Percona-Lab/MySQL-AutoXtraBackup

https://www.percona.com/blog/2017/11/27/perconalab-autoxtrabackup-v1-5-0-release/

mysqlbinlog

# mysqlbinlog --result-file=test.log /var/log/mysql/mysql-bin.000001

Note: You may edit the result file and delete any statements you don't want to execut. Then, do mysql -u root -p < test.log

# mysqlbinlog --result-file=test.log --base64-output=DECODE-ROWS /var/log/mysql/mysql-bin.000001
# mysqlbinlog --result-file=test.log -v /var/log/mysql/mysql-bin.000001
# mysqlbinlog --result-file=test.log -vv /var/log/mysql/mysql-bin.000001

Note: Do more research on global transaction identifier (GTID) vs binary log position

Get binary log from the remote server:

# mysqlbinlog --read-from-remote-server --host=192.168.101.2 -p mysqld-bin.000001

Note: https://www.percona.com/blog/2012/01/18/backing-up-binary-log-files-with-mysqlbinlog/

The output of mysqlbinlog can be used as the input of the mysql client to redo the statements contained in the binary log:

# cd /var/log/mysql
# mysqlbinlog mysql-bin.000001 | mysql -u root -p

canal

https://github.com/alibaba/canal

Pingcap syncer:

https://github.com/pingcap/docs/blob/master/tools/syncer.md

No comments: