flink兼容性验证
flink介绍:https://blog.csdn.net/weixin_43563705/article/details/107604693
一、安装启动
-
安装flink及其依赖
yum install java-1.8.0-openjdk curl tar
mkdir -p /usr/local/flink
wget https://mirrors.aliyun.com/apache/flink/flink-1.16.1/flink-1.16.1-bin-scala_2.12.tgz -
启动flink
cd /usr/local/flink
tar -xvf flink-1.16.1-bin-scala_2.12.tgz
cd flink-1.16.1
./bin/start-cluster.sh
出现如下字样:
Starting cluster.
Starting standalonesession daemon on host bogon.
Starting taskexecutor daemon on host bogon.
二、测试
1、查看摘要信息
curl localhost:8081
如果部署成功,我们可以看到类似如下字样的返回结果
<!--~ Licensed to the Apache Software Foundation (ASF) under one~ or more contributor license agreements. See the NOTICE file~ distributed with this work for additional information~ regarding copyright ownership. The ASF licenses this file~ to you under the Apache License, Version 2.0 (the~ "License"); you may not use this file except in compliance~ with the License. You may obtain a copy of the License at~~ http://www.apache.org/licenses/LICENSE-2.0~~ Unless required by applicable law or agreed to in writing, software~ distributed under the License is distributed on an "AS IS" BASIS,~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~ See the License for the specific language governing permissions and~ limitations under the License.--><!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Apache Flink Web Dashboard</title><link rel="apple-touch-icon" sizes="180x180" href="assets/favicon/apple-touch-icon.png"><link rel="icon" type="image/png" href="assets/favicon/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="assets/favicon/favicon-16x16.png" sizes="16x16"><link rel="manifest" href="assets/favicon/manifest.json"><link rel="mask-icon" href="assets/favicon/safari-pinned-tab.svg" color="#aa1919"><link rel="shortcut icon" href="assets/favicon/favicon.ico"><meta name="msapplication-config" content="assets/favicon/browserconfig.xml"><meta name="theme-color" content="#ffffff"><base href="./">
2、通过web浏览器请求对应服务器8081端口
3、提交任务 WordCount
./bin/flink run examples/streaming/WordCount.jar
可以看到类似如下的输出:
Executing example with default input data.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
Job has been submitted with JobID d4fa249528a524aac35743bc9bc20ae8
Program execution finished
Job with JobID d4fa249528a524aac35743bc9bc20ae8 has finished.
Job Runtime: 1471 ms
之后,可以在网页上看到运行结果
也可以查看执行日志 tail flink-root-taskexecutor-0-bogon.out
(nymph,1)
(in,3)
(thy,1)
(orisons,1)
(be,4)
(all,2)
(my,1)
(sins,1)
(remember,1)
(d,4)
三、清理环境
./bin/stop-cluster.sh
rm -rf /usr/local/flink