通用
如果maxwell挂掉太长时间,positions表中记录的对应binlog文件已经被清理掉,可以去相应的实例上面show binary logs;查看存在的binlog文件信息,将positions表中对应实例的binlog_file字段改为最早的文件名,binlog_position改为0,然后启动maxwell。
注意:记录下maxwell挂掉的时间和启动后生成的第一天信息的update_time时间,然后手动更新监控的mysql表中对应区间的数据产生binlog,找回丢失数据。
update bdp_company.company_contact_details set update_time = update_time + INTERVAL 1 SECOND where update_time between '2022-03-25 01:03:12' and '2022-03-25 10:18:00';
ERROR Maxwell - Maxwell couldn't find the requested binlog, exiting...
原因:一般出现在关闭maxwell一段时间后启动maxwell时,由于记录的binlog文件已被自动删除;有时当很大批量的binlog日志写入时maxwell会缓存下来处理不过来的binlog至文件系统,而当其处理完文件系统的缓存后由于binlog存储空间不足记录的原始位置的binlog文件已被删除,也会出现这个错误
处理方法:调整binlog的存储空间和删除模式,手动修改maxwell的元数据库中的positions表中对应client_id的binlog_file和binlog_position的值
update maxwell.positions set binlog_file = 'mysql-bin.005302',binlog_position = 0 where client_id = 'bdp-rds-003.mysql.rds.aliyuncs.com';
java.lang.RuntimeException: Couldn't find database mysql
原因:账户没有mysql库的访问权限,上游修改了mysql库里的表
处理方法:最优方法是给maxwell使用的用户对应的权限;临时的方法是在maxwell的元数据库中的tables表中插入对应的表的信息,注意对应的database_id
例如:
INSERT INTO maxwell.tables (id, schema_id, database_id, name, charset, pk) VALUES (727, 1092, 54, 'user', 'utf8', 'Host,User');
com.github.shyiko.mysql.binlog.network.ServerException: Could not find first log file name in binary log index file
原因:reset master或者binlog文件更名导致找不到记录的binlog文件等
处理方法:手动修正positions表中对应实例的binlog信息,或者清空/删除maxwell库重建
INFO ListWithDiskBuffer - Overflowed in-memory buffer, spilling over into /tmp/maxwell2979344624043046767events
随后出现
20:58:56,303 ERROR MaxwellKafkaProducer - TimeoutException @ Position[BinlogPosition[mysql-bin.000948:140032012], lastHeartbeat=0] -- maxwell_test: ic_ar:annual_report_base:[(id,452053520)]
20:58:56,303 ERROR MaxwellKafkaProducer - Expiring 13 record(s) for maxwell_test-11: 30302 ms has passed since last append
原因:问题产生的原因还不明,这个问题比较顽固,github上面类似问题都没有达到明确的解决。
个人猜测大概率由于短时间内产生大量需要处理的binlog,maxwell处理不过来导致落地到磁盘,
从而超时导致数据未完整序列化(这也从侧面告诉我们,大表数据迁移,也要批量进行,
不要一个insert into .. select 搞定)
处理方法:
目前比较可行的方法是调大kafka.max.request.size=5242880
kafka.buffer.memory=5242880这两个参数,使数据尽量不落地磁盘
com.zendesk.maxwell.schema.ddl.InvalidSchemaError: Couldn't find table 'XXX' in database XXX
该问题目前分析有两种可能引起:
1. maxwell所配账号无权限访问对应表,导致初始化时在schema中未有该库表结构。
处理方法:在maxwell元数据库中手动配置对应schema、库、表
2. 对应mysql实例在maxwell元数据库中有多套不同server_id的schema,binlog的server_id变更或重启maxwell引起启动时选择了另一个server_id。
处理方法:多次重启至选择目标server_id(不建议);
或者将库中除目标server_id对应的schema外的多份schema和库表全部清除,然后重启至选择目标server_id(可行,不推荐);
或者将对应mysql实例在maxwell元数据库中所有的schema清除,但是记得记录down掉时的binlog的position,然后启动maxwell,后停止修改binlog的position的之前记录的位置,再启动maxwell,如果有已存在的表或者不存在的表再手动补充即可
java.util.concurrent.TimeoutException: BinaryLogClient was unable to connect in 5000ms
错误日志内容:
900578196 [INFO] BinlogConnectorReplicator: Binlog disconnected.
900578224 [WARN] BinlogConnectorReplicator: replicator stopped at position: mysql-bin.017926:327525750 -- restarting
900583225 [WARN] BinaryLogClient: Failed to establish connection in 4999ms. Forcing disconnect.
900583230 [INFO] TaskManager: Stopping 5 tasks
900583230 [ERROR] TaskManager: cause:
java.util.concurrent.TimeoutException: BinaryLogClient was unable to connect in 5000ms
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:877) ~[mysql-binlog-connector-java-0.24.0.jar:0.24.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.ensureReplicatorThread(BinlogConnectorReplicator.java:448) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.getRow(BinlogConnectorReplicator.java:617) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.work(BinlogConnectorReplicator.java:180) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.util.RunLoopProcess.runLoop(RunLoopProcess.java:34) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.Maxwell.startInner(Maxwell.java:255) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.Maxwell.start(Maxwell.java:183) ~[maxwell-1.30.0.jar:1.30.0]
at com.zendesk.maxwell.Maxwell.main(Maxwell.java:286) ~[maxwell-1.30.0.jar:1.30.0]
错误原因:未知
解决方案:重启对应的maxwell实例
Couldn't find table t_restricted_consumer in database
2023-08-21 11:12:31.327 ERROR TaskManager - cause:
java.lang.RuntimeException: Couldn't find table t_restricted_consumer in database db_business_reproduce
at com.zendesk.maxwell.replication.TableCache.processEvent(TableCache.java:35) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.getTransactionRows(BinlogConnectorReplicator.java:592) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.getRow(BinlogConnectorReplicator.java:724) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.work(BinlogConnectorReplicator.java:235) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.util.RunLoopProcess.runLoop(RunLoopProcess.java:34) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.Maxwell.startInner(Maxwell.java:302) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.Maxwell.start(Maxwell.java:227) ~[maxwell-1.40.0.jar:1.40.0]
at com.zendesk.maxwell.Maxwell.main(Maxwell.java:337) ~[maxwell-1.40.0.jar:1.40.0]
解决方案:在databases中写入库信息
oceanbase数据库卡住不消费
>>> tailf /home/maxwell/maxwell-1.40.0/logs/bdp_bid.out
2024-01-22 15:20:43.053 INFO Server - Started Server@5b873c1c{STARTING}[10.0.12,sto=0] @1801ms
2024-01-22 15:20:47.544 ERROR MysqlParserListener - (parse PURGE TABLE __recycle_$_42100023_1705288380474488)
2024-01-22 15:20:47.544 ERROR SchemaChange - Error parsing SQL: 'PURGE TABLE __recycle_$_42100023_1705288380474488'
2024-01-22 15:20:47.545 ERROR AbstractSchemaStore - Error on bin log position Position[BinlogPosition[mysql-bin.000149:191458712], lastHeartbeat=0]
com.zendesk.maxwell.schema.ddl.MaxwellSQLSyntaxError: PURGE
at com.zendesk.maxwell.schema.ddl.MysqlParserListener.visitErrorNode(MysqlParserListener.java:93)
at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:17)
at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
at com.zendesk.maxwell.schema.ddl.SchemaChange.parseSQL(SchemaChange.java:101)
at com.zendesk.maxwell.schema.ddl.SchemaChange.parse(SchemaChange.java:115)
at com.zendesk.maxwell.schema.AbstractSchemaStore.resolveSQL(AbstractSchemaStore.java:49)
at com.zendesk.maxwell.schema.MysqlSchemaStore.processSQL(MysqlSchemaStore.java:102)
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.processQueryEvent(BinlogConnectorReplicator.java:385)
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.processQueryEvent(BinlogConnectorReplicator.java:407)
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.getRow(BinlogConnectorReplicator.java:735)
at com.zendesk.maxwell.replication.BinlogConnectorReplicator.work(BinlogConnectorReplicator.java:235)
at com.zendesk.maxwell.util.RunLoopProcess.runLoop(RunLoopProcess.java:34)
at com.zendesk.maxwell.Maxwell.startInner(Maxwell.java:302)
at com.zendesk.maxwell.Maxwell.start(Maxwell.java:227)
at com.zendesk.maxwell.Maxwell.main(Maxwell.java:337)
>>> mysql -ht4zh2rl5dsfsw.oceanbase.aliyuncs.com -ubdp_nu -p'O_mqMnZVU_(iOohZn8JGs' -e "show binlog events in 'mysql-bin.000149' from 191458712 limit 10"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------------+-----------+-------------+------------+-------------+--------------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----------+-------------+------------+-------------+--------------------------------------------------------------------------+
| mysql-bin.000149 | 191458712 | Query | 1147473732 | 191458822 | use __recyclebin;PURGE TABLE __recycle_$_42100023_1705288380474488 |
| mysql-bin.000149 | 191458822 | Gtid | 1147473732 | 191458887 | SET @@SESSION.GTID_NEXT= '801fd65c-3115-11ee-8871-00163e049509:22356149' |
| mysql-bin.000149 | 191458887 | Query | 1147473732 | 191458941 | BEGIN |
| mysql-bin.000149 | 191458941 | Table_map | 1147473732 | 191459038 | table id: 41399833829172 (bid_cert.tb_rzrk_certificates) |
| mysql-bin.000149 | 191459038 | Update_rows | 1147473732 | 191472758 | table_id: 41399833829172 flags: STMT_END_F |
| mysql-bin.000149 | 191472758 | Xid | 1147473732 | 191472789 | Xid ID=22356149 |
| mysql-bin.000149 | 191472789 | Gtid | 1147473732 | 191472854 | SET @@SESSION.GTID_NEXT= '801fd65c-3115-11ee-8871-00163e049509:22356150' |
| mysql-bin.000149 | 191472854 | Query | 1147473732 | 191472908 | BEGIN |
| mysql-bin.000149 | 191472908 | Table_map | 1147473732 | 191473005 | table id: 41399833829172 (bid_cert.tb_rzrk_certificates) |
| mysql-bin.000149 | 191473005 | Update_rows | 1147473732 | 191482863 | table_id: 41399833829172 flags: STMT_END_F |
+------------------+-----------+-------------+------------+-------------+--------------------------------------------------------------------------+
解决方案: 特定信息解析不的,可以跳过此条,直接进入下一条,比如mysql-bin.000149的191458712这个位置的信息: use __recyclebin;PURGE TABLE __recycle_$_42100023_1705288380474488
>>> mysql -h 10.8.6.87 -uroot -proot123 -P3802 -Dmaxwell -e "select * from positions"
+-----------+------------------+-----------------+----------+-------------+--------------+---------------------+
| server_id | binlog_file | binlog_position | gtid_set | client_id | heartbeat_at | last_heartbeat_read |
+-----------+------------------+-----------------+----------+-------------+--------------+---------------------+
| 2 | mysql-bin.000149 | 191458822 | NULL | bdp_bid | NULL | 0 |
+-----------+------------------+-----------------+----------+-------------+--------------+---------------------+