my2sql
my2sql copied to clipboard
解析MySQL binlog ,可以生成原始SQL、回滚SQL、去除主键的INSERT SQL等,也可以生成DML统计信息以及大事务分析信息。
MySQL 8.0 未来版本会取消 default_authentication_plugin 参数 The syntax '--replica-parallel-type' is deprecated and will be removed in a future release.
context.go:575 Connect mysql failed this authentication plugin is not supported
样例执行过程报这个错误,列名被变更后无法识别到 goroutine 20 [running]: my2sql/sqlbuilder.DoubleColumn(0xc0002f6920, 0xd, 0x728100, 0x79a0c8, 0xc00054a0f0) /root/go/src/my2sql/sqlbuilder/column.go:191 +0xbe my2sql/base.GetMysqlDataTypeNameAndSqlColumn(0xc0002f6910, 0x7, 0xc0002f6920, 0xd, 0xc00502a0f6, 0x728b13, 0x7, 0x79a0c8, 0xc00054a0f0) /root/go/src/my2sql/base/sqlgen.go:81 +0xaa9 my2sql/base.GetSqlFieldsEXpressions(0x3e, 0xc00061f000, 0x3e, 0x40, 0xc000634400, 0x3e, 0x40, 0x0,...
完全的离线分析,不依赖数据库连接查询相关字段信息,或者依赖mysqldump导出的表结构字段文件?
repl 模式 start-pos 会过滤从指定 pos 开始的SQL,file 模式下不生效
/root/czx/my2sql -user root -password 123 -work-type 2sql -start-file mysql-bin.001242 -databases db1 -add-extraInfo -output-dir tmpdir [2021/09/10 11:44:25] [info] events.go:208 start thread to write redo/rollback sql into file [2021/09/10 11:44:25] [info] stats_process.go:166...
建议增加版本控制,增加release版本
1. 当前支持连接数据库解析,如果要解析库中已purge的备份binlog文件, 需要先构建数据库,移动binlog,修改binlog index文件。启动数据库,有些耗时。 可以提供配置文件写入表结构,直接解析么。 2. 当前解析出的SQL,不包含begin, commit等事务信息,可以提供一个选项,支持一下事务么。
我测试了下最新的mysql 8.0.22在mg环境下的binlog my2sql -user admin -password xxxxxxx-host 127.0.0.1 -port 3306 -work-type rollback -start-file mysql-bin.000118 -start-datetime "2021-01-06 18:50:00" -stop-datetime "2021-01-06 18:55:00" -output-dir . [2021/01/06 19:32:30] [info] events.go:58 start thread 2 to...