Fink CDC数据同步(五)Kafka数据同步Hive

6、Kafka同步到Hive

6.1 建映射表

通过flink sql client 建Kafka topic的映射表

复制代码
 CREATE TABLE kafka_user_topic(
     id     int,
     name   string,
     birth  string,
     gender    string
) WITH (
 'connector' = 'kafka',
 'topic' = 'flink-cdc-user',
 'properties.bootstrap.servers' = '192.168.0.4:6668',
 'scan.startup.mode' = 'earliest-offset',
 'format' = 'json'
);

6.2 建hive表

建hive表

复制代码
CREATE TABLE ods_user (
     id     int,
     name   string,
     birth  string,
     gender    string
) STORED AS parquet TBLPROPERTIES (
  'sink.partition-commit.trigger'='partition-time',
  'sink.partition-commit.delay'='0S',
  'sink.partition-commit.policy.kind'='metastore,success-file',
  'auto-compaction'='true',
  'compaction.file-size'='128MB'
);

如果没有切换hive方言建hive表会报错

切换Hive方言

复制代码
SET table.sql-dialect=hive;

hive表

复制代码
CREATE TABLE ods_user (
     id     int,
     name   string,
     birth  string,
     gender    string
) STORED AS parquet TBLPROPERTIES (
  'sink.partition-commit.trigger'='partition-time',
  'sink.partition-commit.delay'='0S',
  'sink.partition-commit.policy.kind'='metastore,success-file',
  'auto-compaction'='true',
  'compaction.file-size'='128MB'
);

6.3 生成作业

生成数据

复制代码
insert into ods_user
select * from kafka_user_topic;

系列文章

Fink CDC数据同步(一)环境部署https://blog.csdn.net/weixin_44586883/article/details/136017355?spm=1001.2014.3001.5502​​​​​​​
Fink CDC数据同步(二)MySQL数据同步https://blog.csdn.net/weixin_44586883/article/details/136017472?spm=1001.2014.3001.5501
Fink CDC数据同步(三)Flink集成Hivehttps://blog.csdn.net/weixin_44586883/article/details/136017571?spm=1001.2014.3001.5501
Fink CDC数据同步(四)Mysql数据同步到Kafkahttps://blog.csdn.net/weixin_44586883/article/details/136023747?spm=1001.2014.3001.5501
Fink CDC数据同步(五)Kafka数据同步Hivehttps://blog.csdn.net/weixin_44586883/article/details/136023837?spm=1001.2014.3001.5501

Fink CDC数据同步(六)数据入湖Hudihttps://blog.csdn.net/weixin_44586883/article/details/136023939?spm=1001.2014.3001.5502

相关推荐
程序新视界6 小时前
MySQL中什么是回表查询,如何避免和优化?
mysql
薛定谔的算法11 小时前
phoneGPT:构建专业领域的检索增强型智能问答系统
前端·数据库·后端
Databend12 小时前
Databend 亮相 RustChinaConf 2025,分享基于 Rust 构建商业化数仓平台的探索
数据库
得物技术13 小时前
破解gh-ost变更导致MySQL表膨胀之谜|得物技术
数据库·后端·mysql
Java水解13 小时前
【MySQL】从零开始学习MySQL:基础与安装指南
后端·mysql
Raymond运维17 小时前
MariaDB源码编译安装(二)
运维·数据库·mariadb
沢田纲吉18 小时前
🗄️ MySQL 表操作全面指南
数据库·后端·mysql
RestCloud1 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud1 天前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence1 天前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库