基于tungsten API 同步mysql binlog出现EOF packet received的问题解决
项目需要,需要实时知道mysql更新的数据,因此需要同步对应mysql结点的binlog日志数据并解析,对于同步与解析tungsten 相关API都
tungsten是一个开源的数据库同步工具,详细可参考官网()
项目需要,需要实时知道mysql更新的数据,因此需要同步对应mysql结点的binlog日志数据并解析,对于同步与解析tungsten 相关API都能实现。其中日志同步主要是RelayClient类,还解析是MysqlExtractor类,对于mysql日志解析,首先需要了解binlog日志格式,主要有(Mixed,row,statement三种),三种日志格式的区别详情见 ,以及在解析过程中跟据应用以及服务器的需求选择不同日志,以及不同日志不同的解析等。
此篇需要记录的是在同步RelayClient日志过程中,在项目结尾阶段,部署后,测试阶段,突然发现开发环境在读完一个Binlog日志后会收到mysql服务器返回EOF的问题,由于开发过程中修改了tungsten API相关代码,开始一直在排查源代码相关问题,以及线上mysql部署的问题,都未发现原因。对于mysql主动关闭感觉到不知所措。
最后通过tungsten相关isSUSE论坛,有人提及多slave引起,以及查看mysql主从同步时,不同slave相关配制时 会配制不同的serverId,立即查看tungsten相关源码,其中有此项配制,由于测试环境与开发环境使用的是同一mysql结点,并且使用了同一serverId,从而引起了此问题的产生,经测试,使用不同serverId,此问题不再重现。
通过以上问题的排查感受很多:1.DB遇到问题时,一定要在可重现的机器上查到问题的原因,中间有想重新配制数据库结点的时候,重新配制开发结点,问题是能得以解决,但是部署线上时此问题一定会重现,从而会引起线上问题,,因为如果DB问题能重现,一定要引起重视,排查出原因。2.对于开源项目使用时,遇到相关问题,查询issus相关论坛很重要,使用过程中也许有人遇到同类问题(在一个连接池源码研究过程中也深有感悟)。3.对于mysql多slave同步知识的不够了解也有一定原因,因为相关问题一定要对相关知识足够熟悉。
小记一下!以表这几天排查过程中的辛酸!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











1. Binlog Binlog is used to record write operations (excluding queries) information performed by the database and save it on the disk in binary form. Binlog is the logical log of mysql and is recorded by the server layer. Mysql databases using any storage engine will record binlog logs. Logical log: can be simply understood as a sql statement; physical log: data in MySQL is stored in the data page, and the physical log records changes on the data page; insert the code piece here and the binlog is written by appending Input, you can set the size of each binlog file through the max_binlog_size parameter. When the file size reaches the given value

1. Introduction to Binlog log Binlog is the abbreviation of Binarylog, that is, binary log. Binlog has three main functions: converting random IO into sequential IO during persistence, master-slave replication and data recovery. This article focuses on issues related to master-slave replication. The Binlog log consists of an index file and many log files. Each log file consists of a magic number and an event. Each log file ends with a Rotate type event. For each event, it can be divided into two parts: event header and event body: The structure of the event header is as follows: The structure of the event body includes two parts: fixed size and variable size. For the format of Binlog log, you can have a simple understanding. Interested students can go deeper.

Preface There are six types of log files in MySQL, namely: redo log (redolog), rollback log (undolog), binary log (binlog), error log (errorlog), slow query log (slowquerylog), general query log (generallog) ), relay log (relaylog). 1. What is redolog? Redolog, also known as redo log file, is used to record changes in transaction operations. It records the value after data modification. It will be recorded regardless of whether the transaction is submitted or not. Redolog files can come in handy when instances and media fail (mediafailure), such as database power outage, Inn

1. Source of the problem When analyzing performance problems, slow queries and binlog slow transactions are commonly used methods. Recently, I was analyzing a slow query and found that it contained a large number of commit statements that were slow, but the matching could not be completed when analyzing the binlog slow transactions. For example, there may be 1,000 commit statements during this period, but there may be only 100 slow transactions. This is too big a difference, so why does this phenomenon occur? 2. The respective determination methods for slow transactions are usually as follows for an explicitly submitted (insert) transaction: GTID_LOG_EVENT and XID_EVENT are the time when the command ‘COMMIT’ is initiated.

Regarding the MySQL binary log (binlog), we all know that the binary log (binlog) is very important, especially when you need point-to-point disaster recovery, so we need to back it up. Regarding the backup of binary log (binlog), you can first switch the binlog based on the flushlogs method, and then copy & compress it to other storage on the remote server or local server, such as mounted NAS storage. You can also use mysqlbinlog to backup the binlog. Implement local backup or remote backup of MySQL binary log (binlog). Finally, the MySQL binary log (binlog

1.Introduction to kingbus 1.1What is kingbus? Kingbus is a distributed MySQL binlog storage system based on the raft strong consistency protocol. It can act as a MySQLSlave to synchronize binlog from the real Master and store it in a distributed cluster. At the same time, it also acts as a MySQLMaster to synchronize the binlog in the cluster to other slaves. kingbus has the following features: It is compatible with the MySQL replication protocol, synchronizes the binlog on the master through Gtid, and supports the slave to pull the binlog from kingbus through Gtid.

What is the difference between MySQLbinlog/redolog/undolog? If I want to talk to you about the locking mechanism in InnoDB, it will inevitably involve the MySQL logging system, binlog, redolog, undolog, etc. I saw that these three logs summarized by some friends are not bad, so I quickly brought them to discuss with you. Share with partners. The log is an important part of the MySQL database, recording various status information during the operation of the database. MySQL logs mainly include error logs, query logs, slow query logs, transaction logs, and binary logs. As a developer, what we need to focus on is the binary log (binlog) and transaction log (including redolog and und

Preface During development, it is necessary to monitor the data table by monitoring the binlog log file of mysql. Since mysql is deployed in a docker container, the problem of data volumes also needs to be solved. 1. Open a mysql image through the data volume dockerrun- p3307:3306--namemyMysql-v/usr/docker/mysql/data:/var/lib/mysql-eMYSQL_ROOT_PASSWORD=123456-dmysql:5.7.25 Note: You need to create a file in the host directory in advance to save mysql Data set, the directory I created here is /u
