实时MySQL二进制日志解析

时间:2021-11-02 14:22:28

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.

我们正在处理基于MySQL 5.0(MyISAM)构建的遗留应用程序。我需要实时知道何时更新,删除或插入特定表。 'gotcha'是我无法以任何方式更改数据库(即写入触发器)。我必须使用bin日志,复制或其他一些非侵入性的东西。

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.

我们已经看过使用'mysqlbinlog'命令来解析二进制日志。然而,这不是实时的,我们宁愿做更多事件驱动的事情。

Any ideas?

有任何想法吗?

3 个解决方案

#1


6  

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

检查MySQL代理。它允许您在命令/响应流中点击,它在Lua中完全可编程。如果需要,您甚至可以实时修改命令

#2


0  

I am experimenting with using mysqlbinlog -R -t to get the feed in realtime, it works until the end, then you need to find the last position read, and continue there, combined with a query for log files this should give you all the files one after another.... am experimenting with this..

我正在尝试使用mysqlbinlog -R -t实时获取feed,它一直工作到最后,然后你需要找到最后一个读取的位置,并继续那里,结合查询日志文件这应该给你所有的文件一个接一个....我正在试验这个..

#3


0  

Also, if you want to know in real time if a change has taken place on one table, then i would suggest that you make a trigger on the master, and then you can insert data into a separate database that is replicated on its own. inside the trigger you can access another server even using a federated server. http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html

此外,如果您想要实时了解是否在一个表上发生了更改,那么我建议您在主服务器上创建一个触发器,然后您可以将数据插入到单独复制的数据库中。在触发器内部,您甚至可以使用联合服务器访问另一台服务器。 http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html

#1


6  

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

检查MySQL代理。它允许您在命令/响应流中点击,它在Lua中完全可编程。如果需要,您甚至可以实时修改命令

#2


0  

I am experimenting with using mysqlbinlog -R -t to get the feed in realtime, it works until the end, then you need to find the last position read, and continue there, combined with a query for log files this should give you all the files one after another.... am experimenting with this..

我正在尝试使用mysqlbinlog -R -t实时获取feed,它一直工作到最后,然后你需要找到最后一个读取的位置,并继续那里,结合查询日志文件这应该给你所有的文件一个接一个....我正在试验这个..

#3


0  

Also, if you want to know in real time if a change has taken place on one table, then i would suggest that you make a trigger on the master, and then you can insert data into a separate database that is replicated on its own. inside the trigger you can access another server even using a federated server. http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html

此外,如果您想要实时了解是否在一个表上发生了更改,那么我建议您在主服务器上创建一个触发器,然后您可以将数据插入到单独复制的数据库中。在触发器内部,您甚至可以使用联合服务器访问另一台服务器。 http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html