hadoop 3.x 案例5:Flink SQL运行报错

文章目录

  • 一. 问题描述
  • 二. 解决方案
  • 参考:

一. 问题描述

启动yarn session后,运行Flink SQL,报错。

命令:

-- 启动yarn-session
/home/flink-1.15.2/bin/yarn-session.sh -d
-- 在yarn session模式下启动flink sql
/home/flink-1.15.2/bin/sql-client.sh embedded -s yarn-session
-- sets up the result mode to tableau to show the results directly in the CLI
set execution.result-mode=tableau;

CREATE TABLE t1(
  uuid VARCHAR(20) PRIMARY KEY NOT ENFORCED,
  name VARCHAR(10),
  age INT,
  ts TIMESTAMP(3),
  `partition` VARCHAR(20)
)
PARTITIONED BY (`partition`)
WITH (
  'connector' = 'hudi',
  'path' = 'hdfs://hp5:8020/user/hudi/t1',
  'table.type' = 'MERGE_ON_READ' -- this creates a MERGE_ON_READ table, by default is COPY_ON_WRITE
);

-- insert data using values
INSERT INTO t1 VALUES
  ('id1','Danny',23,TIMESTAMP '1970-01-01 00:00:01','par1'),
  ('id2','Stephen',33,TIMESTAMP '1970-01-01 00:00:02','par1'),
  ('id3','Julian',53,TIMESTAMP '1970-01-01 00:00:03','par2'),
  ('id4','Fabian',31,TIMESTAMP '1970-01-01 00:00:04','par2'),
  ('id5','Sophia',18,TIMESTAMP '1970-01-01 00:00:05','par3'),
  ('id6','Emma',20,TIMESTAMP '1970-01-01 00:00:06','par3'),
  ('id7','Bob',44,TIMESTAMP '1970-01-01 00:00:07','par4'),
  ('id8','Han',56,TIMESTAMP '1970-01-01 00:00:08','par4');

报错信息:

[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.runtime.client.JobSubmissionException: Failed to submit JobGraph.

hadoop 3.x 案例5:Flink SQL运行报错_第1张图片

二. 解决方案

网上找了下相关案例,采用root 用户启动Flink任务,会在ZK中产生一个之前的jobName文件,再次用子用户名启动任务,会报错。

-- 启动yarn-session(非root)
/home/flink-1.15.2/bin/yarn-session.sh -d
-- 在yarn session模式下启动flink sql (root和非root均可)
/home/flink-1.15.2/bin/sql-client.sh embedded -s yarn-session

hadoop 3.x 案例5:Flink SQL运行报错_第2张图片
``

参考:

  1. https://www.codenong.com/cs106585958/

你可能感兴趣的:(大数据和数据仓库,#,Hadoop大数据平台,sql,hadoop,flink)