Skip to content

可实现进度展示(处理binlog的event数量和耗时时间) #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# reverse_sql 工具介绍
reverse_sql 是一个用于解析和转换 MySQL 二进制日志(binlog)的工具。它可以将二进制日志文件中记录的数据库更改操作(如插入、更新、删除)转换为反向的 SQL 语句,以便进行数据恢复。其运行模式需二进制日志设置为 ROW 格式。

```
reverse_sql工具版本号: 2.1.2,更新日期:2024-08-09 - 增加表字段是json或text类型的支持
编译后的二进制版本下载地址:https://pan.quark.cn/s/35abca11c589
```
该工具的主要功能和特点包括:

1、解析二进制日志:reverse_sql 能够解析 MySQL 的二进制日志文件,并还原出其中的 SQL 语句。
Expand Down Expand Up @@ -31,6 +34,9 @@ reverse_sql 是一个用于解析和转换 MySQL 二进制日志(binlog)的

这样,每个线程的开始时间都会有所偏移,确保处理的时间范围没有重叠,并且覆盖了整个时间范围。最后,将结果保存在一个列表里,并对列表做升序排序,取得最终结果。

### 演示视频
https://edu.51cto.com/video/1659.html

### 使用
```
shell> chmod 755 reverse_sql
Expand Down Expand Up @@ -107,4 +113,25 @@ shell> awk '/^-- SQL执行时间/{filename = "output" ++count ".sql"; print > fi

#### 注:reverse_sql 支持MySQL 5.7/8.0 和 MariaDB,适用于CentOS 7系统。

------------------------------------------------------------------------------------
### Docker部署使用
shell> wget https://github.com/hcymysql/reverse_sql/archive/refs/heads/reverse_sql_progress.zip

shell> unzip reverse_sql_progress.zip

shell> cd reverse_sql_progress

shell> vim Dockerfile
```
FROM centos:7

COPY reverse_sql /root/
RUN chmod 755 /root/reverse_sql
```
shell> docker build -t reverse_sql .

shell> docker run -itd --name reverse_sql reverse_sql /bin/bash

shell> docker exec -it reverse_sql /root/reverse_sql --help

------------------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions requirements_mysql57.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytz
pymysql
mysql-replication==0.45.1
tqdm
4 changes: 4 additions & 0 deletions requirements_mysql8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytz
pymysql
mysql-replication
tqdm
Binary file removed reverse_sql
Binary file not shown.
Loading