配置

新建conf/sql-conf.sql

  1. CREATE CATALOG myhive WITH (
  2. 'type' = 'hive',
  3. 'default-database' = 'default',
  4. 'hive-conf-dir' = '/export/server/hive-2.1.0/conf',
  5. 'hadoop-conf-dir'='/export/server/hadoop2.7/etc/hadoop'
  6. );
  7. -- set the HiveCatalog as the current catalog of the session
  8. USE CATALOG myhive;

下载依赖jar包
https://nightlies.apache.org/flink/flink-docs-release-1.14/zh/docs/connectors/table/hive/overview/#%E8%BF%9E%E6%8E%A5%E5%88%B0hive

c411a3f6-8b24-4528-902b-9f5660741aaa.png
62cd82d5-7831-4cef-ac52-292c397e427f.png

image.png
bin/config.sh 增加 export HADOOP_CLASSPATH=hadoop classpath
启动yarn-session
bin/yarn-session.sh -s 2 -jm 1024 -tm 2048 -nm test1 -d\
启动flink-sql客户端
bin/sql-client.sh embedded -i conf/sql-conf.sql -s yarn-session
切换hive方言
set table.sql-dialect=hive;
session集群关闭
echo “stop” | ./bin/yarn-session.sh -id