flink-6-安装flink本地模式Local

1 Flink安装本地模式Local

(1)安装java的JDK。
#tar -xzvf jdk-8u181-linux-x64.tar.gz -C /usr/local/
#vi /root/.bashrc
export JAVA_HOME=/usr/local/jdk1.8.0_181
export PATH= P A T H : PATH: PATH:JAVA_HOME/bin
#source /root/.bashrc

(2)安装FLink
#tar -xzvf flink-1.7.2-bin-hadoop28-scala_2.12.tgz -C /usr/local
#cd /usr/local
#mv flink-1.7.2/ flink
#vi /root/.bashrc
export FLINK_HOME=/usr/local/flink
export PATH= P A T H : PATH: PATH:FLINK_HOME/bin
#source /root/.bashrc

(3)查看版本
#flink --version
Version: 1.7.2, Commit ID: ceba8af
(4)启动Flink
Flink对于本地模式是开箱即用的。
#start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host localhost.
Starting taskexecutor daemon on host localhost.
#jps
3906 TaskManagerRunner
3479 StandaloneSessionClusterEntrypoint
JobManager同时会在8081端口上启动一个web前端,通过http://localhost:8081来访问。
flink-6-安装flink本地模式Local_第1张图片

通过访问 http://localhost:8081 检查JobManager网页,确保所有组件都启动并已运行。网页会显示一个有效的TaskManager实例。
(5)关闭Flink
#stop-cluster.sh
Stopping taskexecutor daemon (pid: 3906) on host localhost.
Stopping standalonesession daemon (pid: 3479) on host localhost.

(6)运行实例
#flink run /usr/local/flink/examples/batch/WordCount.jar
Starting execution of program
Executing WordCount example with default input data set.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
(a,5)
(action,1)
(after,1)
(against,1)
(all,2)
(and,12)
(arms,1)
(arrows,1)
(awry,1)

你可能感兴趣的:(Flink)