You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
flink 1.14.6
flink cdc mysql connector: 2.2.1
mysql-connector-java 8.0.22
` MySqlSource mySqlSource = MySqlSource.builder()
.hostname(SOURCE_IP)
.port(SOURCE_PORT)
.databaseList(SOURCE_DB) // set captured database
.tableList(SOURCE_TABLS) // set captured table
.username(SOURCE_USER)
.password(SOURCE_PWD)
.serverTimeZone("Asia/Shanghai")
.debeziumProperties(getDebeziumProperties())
.deserializer(new JsonDebeziumDeserializationSchema()) // converts SourceRecord to JSON String
.scanNewlyAddedTableEnabled(true) // enable scan the newly added tables feature
.startupOptions(StartupOptions.initial())
.includeSchemaChanges(true) // converts SourceRecord to JSON String
.build();
private static Properties getDebeziumProperties(){
Properties properties = new Properties();
properties.setProperty("converters", "dateConverters");
//根据类在那个包下面修改
properties.setProperty("dateConverters.type", "pl.MySqlDateTimeConverter");
properties.setProperty("dateConverters.format.date", "yyyy-MM-dd");
properties.setProperty("dateConverters.format.time", "HH:mm:ss");
properties.setProperty("dateConverters.format.datetime", "yyyy-MM-dd HH:mm:ss");
properties.setProperty("dateConverters.format.timestamp", "yyyy-MM-dd HH:mm:ss");
properties.setProperty("dateConverters.format.timestamp.zone", "UTC+8");
properties.setProperty("debezium.snapshot.locking.mode","none"); //全局读写锁,可能会影响在线业务,跳过锁设置
properties.setProperty("include.schema.changes", "true");
properties.setProperty("bigint.unsigned.handling.mode","long");
properties.setProperty("decimal.handling.mode","double");
return properties;
}
`
前4条是历史数据,timecol仍然为空,但是最后一条新增数据能正常转换显示。
MySqlDateTimeConverter.java 是参考的https://blog.csdn.net/qq_30529079/article/details/127809317
请问怎么解决呢?
Beta Was this translation helpful? Give feedback.
All reactions