4

I have mysql binlog enabled in row format. I am using mysqlbinlog to parse binlog file. I am using this command:

 mysqlbinlog --base64-output=decode-rows -vv ./mysql-bin.000004

This command returns sql statements that I have to parse to generate json.

I used pymysqlreplication module in python but it doesn't read from binlog file. It requires real-time mysql replication connection. I can't access archived binlog files using master server.

Is there any way to parse archived binlog file and generate json?

Branel Moro
  • 132
  • 2
  • 9

2 Answers2

4

You can use binlog-parser.

A tool for parsing a MySQL binlog file to JSON. Reads a binlog input file, queries a database for field names, writes JSON to stdout.

Peter
  • 357
  • 3
  • 10
1

You can use

https://github.com/noplay/python-mysql-replication

This is used by several independent projects as mentioned on their page.

I have created a separate binlog parser based on sqlparse(python). The link to that :

https://github.com/monothorn/mysql-parser
saurabh
  • 601
  • 6
  • 8