Flink Standalone集群安装
[toc]
# 服务器清单
服务器Host:bigdata-master、bigdata-slave1、bigdata-slave2
# 下载
wget https://archive.apache.org/dist/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
1
# 安装
# 解压
tar -zxvf flink-1.14.3-bin-scala_2.12.tgz -C /usr/local/src/
cd /usr/local/src/
mv flink-1.14.3/ flink/
1
2
3
2
3
# 配置环境变量
#flink
export FLINK_HOME=/usr/local/src/flink
export PATH=$PATH:$FLINK_HOME/bin
1
2
3
2
3
一行命令快速配置
grep -qFx 'export FLINK_HOME=/usr/local/src/flink' /etc/profile || echo 'export FLINK_HOME=/usr/local/src/flink' >> /etc/profile; grep -qFx 'export PATH=$PATH:$FLINK_HOME/bin' /etc/profile || echo 'export PATH=$PATH:$FLINK_HOME/bin' >> /etc/profile
1
# 修改配置文件
在bigdata-master
服务器修改flink-conf.yaml
文件
$ vim /usr/local/src/flink/conf/flink-conf.yaml
# 设置JobManager的host
jobmanager.rpc.address: bigdata-master
1
2
3
2
3
修改master和workers文件
$ vim /usr/local/src/flink/conf/masters
bigdata-master:8021
$ vim /usr/local/src/flink/conf/workers
bigdata-slave1
bigdata-slave2
1
2
3
4
5
6
2
3
4
5
6
# 同步安装包到其他机器
$ scp -r /usr/local/src/flink/ root@bigdata-slave1:/usr/local/src/
$ scp -r /usr/local/src/flink/ root@bigdata-slave2:/usr/local/src/
1
2
2
# 运行
在bigdata-master
服务器运行
source /etc/profile
start-cluster.sh
1
2
2
提示
# start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host bigdata-master.
Starting taskexecutor daemon on host bigdata-slave1.
Starting taskexecutor daemon on host bigdata-slave2.
1
2
3
4
5
2
3
4
5
日志位置/usr/local/src/flink/log
# WebUI
http://172.16.25.219:8081/
# 任务提交
flink run -m master:8081 /usr/local/src/flink/examples/batch/WordCount.jar
1
上次更新: 2024/07/12, 13:19:37