簡體   English   中英

MySQL 使用 Debezium 更改為 Kafka - 僅捕獲 DDL stmts

[英]MySQL changes to Kafka Using Debezium - Capturing only DDL stmts

為 CDC 配置了 MySQL-Debezium。 它正在捕獲 DDL 更改,例如創建/刪除表,但不捕獲 DML 事件。 使用 MySQL 8.0.11 和嵌入式 debezium 版本 0.8.3.Final。

MySQL 服務器在創建表時未進行任何其他配置。

使用以下代碼創建配置 bean

@Bean
public io.debezium.config.Configuration customerConnector() {
        return io.debezium.config.Configuration.create()
            .with(EmbeddedEngine.CONNECTOR_CLASS, "io.debezium.connector.mysql.MySqlConnector")
            .with(EmbeddedEngine.OFFSET_STORAGE, "org.apache.kafka.connect.storage.FileOffsetBackingStore")
            .with(EmbeddedEngine.OFFSET_STORAGE_FILE_FILENAME, "path-to-file")
            .with("offset.flush.interval.ms", 60000)
            .with(EmbeddedEngine.ENGINE_NAME, "customer-mysql-connector")
            .with(MySqlConnectorConfig.SERVER_NAME, databaseServer)
            .with(MySqlConnectorConfig.HOSTNAME, databaseServer)
            .with(MySqlConnectorConfig.PORT, databasePort)
            .with(MySqlConnectorConfig.USER, databaseUser)
            .with(MySqlConnectorConfig.PASSWORD, databasePassword)
            .with(MySqlConnectorConfig.DATABASE_WHITELIST, databaseSchemaName)
            .with(MySqlConnectorConfig.TABLE_WHITELIST, databaseTable)
            .with(MySqlConnectorConfig.DATABASE_HISTORY,
                    MemoryDatabaseHistory.class.getName()).build();
}

以下是作為 Springboot 應用程序啟動時的日志

2020-05-29 21:24:28.028  INFO 5576 --- [pool-1-thread-1] i.d.connector.mysql.MySqlConnectorTask   : MySQL has the binlog file 'binlog.000009' required by the connector
2020-05-29 21:24:28.072  INFO 5576 --- [pool-1-thread-1] io.debezium.util.Threads                 : Requested thread factory for connector MySqlConnector, id = localhost named = binlog-client
2020-05-29 21:24:28.074  INFO 5576 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-29 21:24:28.074  INFO 5576 --- [pool-1-thread-1] io.debezium.util.Threads                 : Creating thread debezium-mysqlconnector-localhost-binlog-client
2020-05-29 21:24:28.090  INFO 5576 --- [-localhost:3306] io.debezium.util.Threads                 : Creating thread debezium-mysqlconnector-localhost-binlog-client
2020-05-29 21:24:28.121  INFO 5576 --- [-localhost:3306] c.g.shyiko.mysql.binlog.BinaryLogClient  : Connected to localhost:3306 at binlog.000009/3786 (sid:6293, cid:36)
2020-05-29 21:24:28.121  INFO 5576 --- [-localhost:3306] i.debezium.connector.mysql.BinlogReader  : Connected to MySQL binlog at localhost:3306, starting at binlog file 'binlog.000009', pos=3786, skipping 8 events plus 0 rows
2020-05-29 21:24:28.121  INFO 5576 --- [-localhost:3306] io.debezium.util.Threads                 : Creating thread debezium-mysqlconnector-localhost-binlog-client
2020-05-29 21:24:28.183  INFO 5576 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2020-05-29 21:24:28.199  INFO 5576 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2020-05-29 21:24:28.199  INFO 5576 --- [           main] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references

有什么線索嗎? 謝謝!

table.whitelist應該設置為<schema>.<table>所以在你的情況下source.customer

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM