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

相关推荐
nbwenren5 分钟前
办公AI实测:Gemini3、GPT-4o、Claude3.5谁更强?
服务器·数据库·php
2401_824222699 分钟前
如何卸载并重装Oracle Grid_Deinstall脚本与ASM磁盘清理
jvm·数据库·python
杨云龙UP12 分钟前
Oracle数据库启动失败:ORA-29701、ORA-01565、ORA-17503故障处理记录_20260429
linux·运维·数据库·oracle·centos
qq_4142565712 分钟前
生产库如何利用Navicat实现配置特定触发器事件调度_提高管理效率
jvm·数据库·python
2301_8084143814 分钟前
MySQL表的约束
数据库·mysql
2301_7756398918 分钟前
mysql如何查看服务器支持的存储引擎_使用SHOW ENGINES命令
jvm·数据库·python
a7963lin20 分钟前
html标签怎样表示搜索框_input type=search语义优化【操作】
jvm·数据库·python
a7963lin24 分钟前
Python数据分析如何识别异常值_IQR四分位距检测法实战
jvm·数据库·python
m0_6138562926 分钟前
如何解决宝塔面板Web端文件管理器打开目录时反应极其缓慢
jvm·数据库·python
阿丰资源32 分钟前
基于Spring Boot的新闻推荐系统(源码+数据库+文档)
数据库·spring boot·后端