0-mac安装flink
Mac环境部署flink
1. 环境准备
- MacOS
- flink1.11.1
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
安装
-
解压到安装目录
tar zxvf flink-1.11.0-bin-scala_2.11.tgz -C /usr/local/
-
配置环境变量
vim ~/.bash_profile
,添加export FLINK_HOME=/usr/local/flink-1.11.0,并且在PATH后追加:$FLINK_HOME/bin,保存后source ~/.bash_profile
-
启动flink
start-cluster.sh
-
访问webUI http://localhost:8081/#/overview
-
运行SQL_Client
sql-client.sh embedded
集成hive
- 配置sql-client-hive.yaml
cp $FLINK_HOME/conf/sql-client-defaults.yaml $FLINK_HOME/conf/sql-client-hive.yaml
- 准备hive-site.xml文件
- 修改配置文件
catalogs:
- name: myhive
type: hive
hive-conf-dir: /usr/local/flink-1.11.0/hive_conf
hive-version: 1.1.1
execution:
type: batch
- 拷贝jar包 flink-shaded-hadoop-2-uber-2.6.5-10.0.jar hive-exec-1.1.1.jar hive-metastore-1.1.0.jar libfb303-0.9.2.jar flink-connector-hive_2.11-1.10.1.jar
- 启动flink start-cluster.sh
- 启动sql-client sql-client.sh embedded -d $FLINK_HOME/conf/sql-client-hive.yaml -l $FLINK_HOME/lib
- 查询结果