系统环境:CentOS7.8
flink版本:下载和Scala版本对应的
flink官方下载地址:https://flink.apache.org/downloads.html
查看jdk
[root@localhost bin]# java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
安装:
解压到指定文件夹
[root@localhost tools]# tar zxvf flink-1.11.6-bin-scala_2.12.tgz -C /root/training/
到安装目录的文件夹下:
[root@localhost ]# cd /root/training/flink-1.11.6/
启动flink服务:
[root@localhost flink-1.11.6]# bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host localhost.
Starting taskexecutor daemon on host localhost.
jps查看进程:
[root@localhost flink-1.11.6]# jps
7926 TaskManagerRunner
8023 Jps
7614 StandaloneSessionClusterEntrypoint
TaskManagerRunner和StandaloneSessionClusterEntrypoint启动才算安装成功;
开始我的TaskManagerRunner没启动,网上找了好多方法都没解决,最后解决办法:
- 停止flink:
[root@localhost flink-1.11.6]# bin/stop-cluster.sh
No taskexecutor daemon (pid: 6460) is running anymore on localhost.
No standalonesession daemon (pid: 6150) is running anymore on localhost.
最后发现进程还在:
[root@localhost flink-1.11.6]# jps
7202 Jps
2394 StandaloneSessionClusterEntrypoint
- 直接有kill杀死:
[root@localhost flink-1.11.6]# kill -9 2394
[root@localhost flink-1.11.6]# jps
7217 Jps
- 再次启动flink:
[root@localhost flink-1.11.6]# bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host localhost.
Starting taskexecutor daemon on host localhost.
[root@localhost flink-1.11.6]# jps
7926 TaskManagerRunner
8023 Jps
7614 StandaloneSessionClusterEntrypoint
5、浏览器访问flink服务,直接访问:http://自己ip:8081/#/overview,可以看到flink已经正常启动。
运行flink自带样例词频统计:
[root@localhost bin]# ./flink run ../examples/batch/WordCount.jar
Executing WordCount example with default input data set.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
Job has been submitted with JobID 6959c79777833ad39b8847cb3d3f736d
Program execution finished
Job with JobID 6959c79777833ad39b8847cb3d3f736d has finished.
Job Runtime: 3239 ms
Accumulator Results:
- fe3b95521fed6b0e1774cd035c55fe5b (java.util.ArrayList) [170 elements]
.......
(respect,1)
(returns,1)
(rub,1)
(s,5)
(say,1)
(scorns,1)
(sea,1)
安装测试完成。
希望对你有帮助!!!!!!!!