Debezium mysql连接器在快照的最后阶段失败。这个项目是在maven/quarkus上进行的,我想使用debezium/无穷大容量来实现缓存失效。
观察者和配置如下所示:
public void startEmbeddedEngine(@观察者@Initialized(ApplicationScoped.class)对象init)抛出IOException {File.createTempFile=File.createTempFile(“偏移”,".dat");文件offsetStorageTempFile = File.createTempFile("dbhistory",".dat");
final Properties props = new Properties();
props.setProperty("name", "cache-invalidation-engine");
props.setProperty("connector.class", "io.debezium.connector.mysql.MySqlConnector");
props.setProperty("offset.storage.file.filename", offsetStorageTempFile.getAbsolutePath());
props.setProperty("offset.flush.interval.ms", "0");
props.setProperty("database.hostname", "localhost");
props.setProperty("database.port", "3306");
props.setProperty("database.user", "root");
props.setProperty("database.password", "password");
props.setProperty("database.server.id", "1");
props.setProperty("database.server.name", "new_feature");
props.setProperty("database.history",
"io.debezium.relational.history.FileDatabaseHistory");
props.setProperty("database.history.file.filename", dbHistoryTempFile.getAbsolutePath());
props.setProperty("database.include.list", "database");
// props.setProperty("database.history.file.filename","C:/Users/a.pogonet/AppData/Local/Temp/db.dat");
props.setProperty("snapshot.mode", "never");
// props.setProperty("include.unknown.datatypes", "true");
// props.setProperty("include.schema.changes", "false");
DebeziumEngine<ChangeEvent<String, String>> engine = DebeziumEngine.create(Json.class)
.using(props)
.notifying(record -> {
System.out.println(record);
}).build();
executorService = Executors.newSingleThreadExecutor();
executorService.execute(engine);
}2021-12-09 14:18:34,137 INFO io.deb.con.mys.MySqlStreamingChangeEventSource在0事件后停止读取binlog,在线程"blc-localhost:3306“java.lang.NoSuchMethodError: java.lang.NoSuchMethodError:java.lang.NoSuchMethodError中没有记录新的偏移量。在io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.extractCharset(MySqlAntlrDdlParser.java:404) at io.debezium.connector.mysql.antlr.listener.CreateAndAlterDatabaseParserListener.enterCreateDatabaseOption(CreateAndAlterDatabaseParserListener.java:49) at io.debezium.ddl.parser.mysql.generated.MySqlParser$CreateDatabaseOptionContext.enterRule(MySqlParser.java:5912) at io.debezium.antlr.ProxyParseTreeListenerUtil.delegateEnterRule(ProxyParseTreeListenerUtil.java:46) at io.debezium.connector.mysql.antlr.listener.MySqlAntlrDdlParserListener.enterEveryRule(MySqlAntlrDdlParserListener.java:89) at org.antlr.v4.runtime.tree.ParseTreeWalker。org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:25),org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28),org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28),org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28),org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28),org.antlr.v4。runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28) at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:87) at io.debezium.connector.mysql.MySqlDatabaseSchema.parseDdl(MySqlDatabaseSchema.java:216) at io.debezium.connector.mysql.MySqlDatabaseSchema.parseStreamingDdl(MySqlDatabaseSchema.java:202) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleQueryEvent(MySqlStreamingChangeEventSource.java:573) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$execute$14(MySqlStreamingChangeEventSource.java:827) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.handleEvent(io.debezium.connector.mysql.MySqlStreamingChangeEventSource.lambda$execute$25(MySqlStreamingChangeEventSource.java:855) at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1125) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:973) at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:599) at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) at java.base/java.lang.Thread.run(Thread.java:834)
发布于 2021-12-09 20:13:37
Quarkus正在执行MySQL驱动程序的一个版本,AFAICS使用的方法在此版本的驱动程序中不再可用。
我建议您使用Debezium连接器使用的驱动程序版本,在项目中手动重写该版本。
我无法确切地告诉您使用哪个版本,因为我不知道您使用的是哪个Debezium版本。但是Debezium 1.8:https://github.com/debezium/debezium/blob/1.8/pom.xml#L120的版本就在那里。
尽管如此,Quarkus 2.5.1.Final+也在使用MySQL连接器8.0.27,所以如果使用这些版本,我认为它应该可以工作。
发布于 2022-07-26 05:20:53
您需要将mysql驱动程序更新为8.0.27
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>https://stackoverflow.com/questions/70289942
复制相似问题