利用开源binlog2sql 闪回误删除的表--安装篇

使用前提:binglog_format=row,binlog_row_image=full

外网安装:https://github.com/danfengcao/binlog2sql

内网安装:按课程安装:binlog2sql-fg.zip

1.解压后进入binlog2sql_dependencies目录

cd binlog2sql_dependencies

2.解压缩 setuptools-0.6c11

tar -xvf  setuptools-0.6c11

3.

进入setuptools-0.6c11目录 解析安装setup.py

python setup.py install

4.

解压pip-9.0.1目录

tar -xvf pip-9.0.1  

进入并按照setup

python setup.py install

5.解压mysql-replication-0.9.tar.gz

pip install *.whl mysql-replication-0.9.tar.gz

依赖包安装完成:

安装完成后,设置环境变量,别名:

alias binlog2sql='python /mysql/binlog2sql/binlog2sql/binlog2sql/binlog2sql.py'

binlog2sql --help

[root@itpuxdb binlog2sql]# binlog2sql --help

usage: binlog2sql.py [-h host] [-u user] [-p password] [-P port]

[--start-file STARTFILE] [--start-position STARTPOS]

[--stop-file ENDFILE] [--stop-position ENDPOS]

[--start-datetime STARTTIME] [--stop-datetime STOPTIME]

[--stop-never] [--help] [-d [databases [databases ...]]]

[-t [tables [tables ...]]] [-K] [-B]

Parse MySQL binlog to sql you want

optional arguments:

--stop-never wait for more data from the server. default: stop

replicate at the last binlog when you start binlog2sql

--help help infomation

-K, --no-primary-key Generate insert sql without primary key if exists

-B, --flashback Flashback data to start_postition of start_file

connect setting:

-h host, --host host host the MySQL database server located

-u user, --user user MySQL Username to log in as

-p password, --password password

MySQL password to use

-P port, --port port MySQL port to use

range filter:

--start-file STARTFILE

start binlog file to be parsed

--start-position STARTPOS, --start-pos STARTPOS

start position of the --start-file

--stop-file ENDFILE, --end-file ENDFILE

stop binlog file to be parsed. default: '--start-file'

--stop-position ENDPOS, --end-pos ENDPOS

stop position of --stop-file. default: latest position

of '--stop-file'

--start-datetime STARTTIME

start reading the binlog at first event having a

datetime equal or posterior to the argument; the

argument must be a date and time in the local time

zone, in any format accepted by the MySQL server for

datetime and timestamp types, for example: 2004-12-25

11:25:56 (you should probably use quotes for your

shell to set it properly).

--stop-datetime STOPTIME

stop reading the binlog at first event having a

datetime equal or posterior to the argument; the

argument must be a date and time in the local time

zone, in any format accepted by the MySQL server for

datetime and timestamp types, for example: 2004-12-25

11:25:56 (you should probably use quotes for your

shell to set it properly).

schema filter:

-d [databases [databases ...]], --databases [databases [databases ...]]

dbs you want to process

-t [tables [tables ...]], --tables [tables [tables ...]]

tables you want to process

猜你喜欢

转载自blog.csdn.net/ichglauben/article/details/81429107