Skip to content

kafka输出中关于 datetime timestamp 和时区的问题 #1043

@ghost

Description

场景

有如下从MySQL经kafka最终复制到DB2的过程:

MySQL --(dtle)--> kafka --(Confluent JDBC Sink Connector)--> DB2
  • 其中MySQL和DB2的默认时区推测为+8.
  • 源端、目标端试验表各有4个字段
  • 进行两次测试, JDBC Sink Connector配置项db.timezone分别设为了+8和UTC

结果

field MySQL type DB2 type kafka中间值 +8区结果 UTC结果
createDate date date 该日期零点的UTC timstamp / 24 / 3600 正确 早1天
createTime datetime time +8区timestamp * 1000 晚8小时 正确
updateDate timestamp timestamp UTC时间如2000-01-01T00:00:00Z 正确 早8小时
updateTime datetime timestamp +8区timestamp * 1000 晚8小时 正确

对于db.timezone的两种配置, 各有一部分数据类型是正确的.

需要解释

  • 哪种db.timezone是合理设置
  • 应从哪个角度修正时区偏差

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions