flink1.12 sql sql-client命令行连接yarn

step1 开辟资源

这里 fcqueue 是yarn资源队列名称 默认是default

yarn-session.sh -s 2 -jm 1024 -tm 2048 -nm yydd -qu fcqueddue
// 如果需要后台运行: yarn-session.sh -s 2 -jm 1024 -tm 2048 -nm yydd -qu fcqueude -d

step2 提交任务

sql-client.sh embedded -s yarn-session

使用demo

-- 建表
CREATE TABLE a(
  dt STRING COMMENT 'dt',
  recordId STRING COMMENT 'recordId',
  relatedFace BIGINT COMMENT 'relatedFace',
  json STRING COMMENT 'json',
  extRecordId STRING COMMENT 'extRecordId',
  capTime BIGINT COMMENT 'capTime',
  channelId STRING COMMENT 'channelId'
) WITH (
 'connector' = 'kafka',
 'topic' = 'fc_body_in_record',
 'properties.zookeeper.connect' = '192.169.0.8:2181/kafka',
 'properties.bootstrap.servers' = '192.169.0.20:9090',
 'format' = 'json',
 'properties.group.id' = 'group-id-1-1655976263361',
 'scan.startup.mode' = 'earliest-offset'
);

-- 查询
select * from a;

你可能感兴趣的:(Flink,sql,kafka,java)