springboot:实现mysql-cdc

cfh9epnr  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(400)

我试图用springboot捕捉mysql本地数据库的任何更改,但是当我运行我的项目时 Unable to instantiate connector class io.debezium.connector.mysql.mysqlconnector 有人给我小费吗?
这是我的配置代码:

@Bean
public io.debezium.config.Configuration studentConnector() {
    return io.debezium.config.Configuration.create()
            .with("connector.class", "io.debezium.connector.mysql.mysqlconnector")
            .with("offset.storage",  "org.apache.kafka.connect.storage.FileOffsetBackingStore")
            .with("offset.storage.file.filename", "/cdc/offset.dat")
            .with("offset.flush.interval.ms", 60000)
            .with("name", "student-postgres-connector")
            .with("database.server.name", studentDBHost+"-"+studentDBName)
            .with("database.hostname", studentDBHost)
            .with("database.port", studentDBPort)
            .with("database.user", studentDBUserName)
            .with("database.password", studentDBPassword)
            .with("database.dbname", studentDBName)
            .with("table.whitelist", STUDENT_TABLE_NAME)
            .build();
}

这是我的应用程序日志错误

java.lang.ClassNotFoundException: io.debezium.connector.mysql.mysqlconnector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_181]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_181]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_181]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_181]
at io.debezium.embedded.EmbeddedEngine.run(EmbeddedEngine.java:666) ~[debezium-embedded-1.3.1.Final.jar:1.3.1.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_181]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181]
yxyvkwin

yxyvkwin1#

既然你想用 MySqlConnector ,您需要将docker图像从 debezium/postgres (不包含debezium mysql连接器)到 debezium/connect .

相关问题