欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

flink1.12 flink-sql client 调试

程序员文章站 2022-07-14 12:30:56
...

flink1.12 下载安装

flink-sql

把flink-connector-kafka_2.11-1.12.2.jar,flink-json-1.12.2.jar,flink-sql-connector-kafka_2.11-1.12.0.jar,jackson-core-2.9.5.jar,jackson-databind-2.9.5.jar放到$FLINK_HOME/lib里面,不放会class not found,而且放完jar后要重启yarn-seesion,不然会加载不到jar包

cd $FLINK_HOME

#启动yarn session
./bin/yarn-session.sh --detached

#启动sql client
./bin/sql-client.sh embedded

#创建kafka源表
CREATE TABLE source_kafka (
  message string,
  `ts` TIMESTAMP(3) METADATA FROM 'timestamp'
) WITH (
  'connector' = 'kafka',
  'topic' = 'binlog-bingtang_log',
  'properties.bootstrap.servers' = '172.17.32.10:9092',
  'properties.group.id' = 'flink_group_test',
  'scan.startup.mode' = 'earliest-offset',
  'format' = 'json');
  
##查询
select * from source_kafka;

相关标签: 大数据 flink