当前位置:   article > 正文

Caused by: org.apache.flink.table.api.ValidationException: The MySQL server has a timezone offset_the mysql server has a timezone offset (28800 seco

the mysql server has a timezone offset (28800 seconds ahead of utc) which do

Caused by: org.apache.flink.table.api.ValidationException: The MySQL server has a timezone offset (28800 seconds ahead of UTC) which does not match the configured timezone America/New_York. Specify the right server-time-zone to avoid inconsistencies for time-related fields.

flink cdc 由mysql往flink table表里面同步数据时报上面错,是由于flink table创建时数据库服务器中的会话时区设置的不对。

配置上'server-time-zone' = 'Asia/Shanghai'  即可

CREATE TABLE products (
    id INT,
    name STRING,
    description STRING,
    PRIMARY KEY (id) NOT ENFORCED
  ) WITH (
    'server-time-zone' = 'Asia/Shanghai',
    'connector' = 'mysql-cdc',
    'hostname' = '192.168.56.130',
    'port' = '3306',
    'username' = 'root',
    'password' = 'root',
    'database-name' = 'cdc',
    'table-name' = 'products'
  );

MySQL CDC 连接器 — CDC Connectors for Apache Flink® documentation

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/795338
推荐阅读
相关标签
  

闽ICP备14008679号