Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real-Time MySQL binary log parsing

Tags:

mysql

we are dealing with a legacy application built on MySQL 5.0 (MyISAM). I need to know in real-time when an update, delete, or insert happens to a particular table. The 'gotcha' is that I can't change the db (i.e. write triggers) in any way. I have to use the bin log, replication or something else which is somewhat non-invasive.

We've looked at using the 'mysqlbinlog' command to parse the binary log. However, this is not real-time and we'd rather do something more event driven.

Any ideas?

like image 414
JJohnson Avatar asked Oct 23 '08 20:10

JJohnson


People also ask

How do I read MySQL binary logs?

You can use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. You can also read binary logs from a remote server by using the --read-from-remote-server option. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server.

How do I enable binary logging in MySQL?

Enabling the binary logs MySQL binary logs can be enabled or disabled by adding or removing the log-bin configuration option. The log-bin parameter is in the configuration files named my. ini. When we install MySQL Server, the configuration file is created in C:\ProgramData\MySQL\MySQL Server 8.0 directory.

What is MySQL binary log?

The binary log is a set of log files that contain information about data modifications made to a MySQL server instance. The log is enabled by starting the server with the --log-bin option. The binary log was introduced in MySQL 3.23.

How do I purge binary logs in MySQL?

To safely purge binary log files, follow this procedure: On each replica, use SHOW REPLICA STATUS to check which log file it is reading. Obtain a listing of the binary log files on the source with SHOW BINARY LOGS . Determine the earliest log file among all the replicas.


1 Answers

check MySQL Proxy. it lets you tap right in the command/response stream, and it's fully programmable in Lua. you can even modify commands in real time, if you want

like image 121
Javier Avatar answered Oct 24 '22 16:10

Javier