先查看centos中自带的jdk并卸载

1
2
3
4
5
6
7
[root@root ~]# rpm -qa | grep java     //查看
tzdata-java-2016c-1.el6.noarch
java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
[root@root ~]# rpm -e --allmatches --nodeps java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64 //卸载
[root@root ~]# rpm -e --allmatches --nodeps java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64 //卸载
[root@root ~]# rpm -qa | grep java //再次查看

开发版openjdk(非开发版还需单独额外安装jps等工具)

1
yum install -y  java-1.8.0-openjdk-devel

flink(https://flink.apache.org/downloads.html)

1
2
3
cd /opt/flink
wget https://dlcdn.apache.org/flink/flink-1.14.0/flink-1.14.0-bin-scala_2.11.tgz --no-check-certificate
tar -zxf flink-1.14.0-bin-scala_2.11.tgz

配置

1
2
3
4
5
6
7
8
9
10
11
12
vi /etc/profile
...
#set java environment
#jdk具体路径 whereis java再看
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH
export FLNK_HOME=/opt/flink/flink-1.14.0
export PATH=$FLINK_HOME/bin:$PAT
...
source /etc/profile

启动

1
2
./start-cluster.sh
less log/flink-*-standalonesession-*.log

仪表盘
http://192.168.56.104:8081/#/overview

测试自身携带的jar包
/opt/flink/flink-1.14.0/bin/flink run /opt/flink/flink-1.14.0/examples/batch/WordCount.jar