Backup mysql for xtrabackup with xbstream and lz4, xtrabackupxbstream
You need to temporarily add an instance for mysql. Using xtrabackup is the easiest and quickest.
On an existing data node:
/Home/work/app/xtrabackup-2.2.3/innobackupex -- ibbackup =/home/work/app/xtrabackup-2.2.3/xtrabackup -- parallel = 8 -- defaults-file =$ {BACKUP_CNF} -- socket = $ {BACKUP_SOCK} -- user = {BACKUP_USER} -- password =$ {BACKUP_PWD }$ {BAK} -- no-timestamp -- stream = xbstream | lz4-B4 | nc host port
On the data node for temporary requisition:
Nc-l port | lz4-B7-d |/home/work/application/xtrabackup-2.2.3/xbstream-x
Restored after transfer
/Home/work/app/xtrabackup-2.2.3/innobackupex -- ibbackup =/home/work/app/xtrabackup-2.2.3/xtrabackup -- parallel = 8 -- apply-log -- use-memory = 4G -- defaults -file =$ {BACKUP_CNF }$ {BAK}
Tudou@ B2C .xiaomi.com
The advantage of xbstream is that you can use the -- parallel = 8 parameter for parallel backup.
Lz4 is used to increase the compression and decompression speed. The following describes the installation process of lz4 in centos.
Wget -- content-dispositionHttps://github.com/Cyan4973/lz4/archive/r122.tar.gz
Tar zxf lz4-r122.tar.gz
Cd lz4-r122/
Make-j 4
Make install PREFIX =/home/work/app/lz4-r122
Compression
Lz4-B4
Extract
Lz4-B7-d
Help Information
Lz4 -?
Incorrect parameters
Usage:
Lz4 [arg] [input] [output]
Input: a filename
With no FILE, or when FILE is-or stdin, read standard input
Arguments:
-1: Fast compression (default)
-9: High compression
-D: decompression (default for. lz4 extension)
-Z: force compression
-F: overwrite output without prompting
-H/-H: display help/long help and exit
The result of backing up the mysql database with xtrabackup is only data, but there are still insert statements.
All the data backed up, including the insert