Bootstrap

Flink整合Hudi及使用

1、jar包上传

上传jar包即可完成整合

# 1、将hudi-flink1.15-bundle-0.15.0.jar包上传到flink的lib目录下
/usr/local/soft/flink-1.15.3/lib

-- 如果没有启动集群,直接忽略
#  2、重启flink的集群
yarn application -list
yarn application -kill application_1706339492248_0003
yarn-session.sh -d

# 重启命令行
sql-client.sh

2、使用

-- 创建表
CREATE TABLE students_hudi(
    id STRING PRIMARY KEY NOT ENFORCED,
    name STRING,
    age INT,
    sex STRING,
    clazz STRING
)
PARTITIONED BY (clazz)
WITH (
  'connector' = 'hudi',
  'path' = 'hdfs://master:8020/data/hudi/students',
  'table.type' = 'MERGE_ON_READ'
);

-- 插入数据
insert into students_hudi
values('1500100003','施小还',23,'女','文科六班');

;