2025最新版flink2.0.0安装教程(保姆级)

Flink支持多种安装模式。

local(本地)——本地模式

standalone——独立模式,Flink自带集群,开发测试环境使用

standaloneHA—独立集群高可用模式,Flink自带集群,开发测试环境使用

yarn——计算资源统一由Hadoop YARN管理,生产环境测试

flink1.13 (2021)和 flink2.0.0 (2025)之间的区别:

下载链接:

https://dlcdn.apache.org/flink/flink-2.0.0/flink-2.0.0-bin-scala_2.12.tgz

升级 jdk

不升级 jdk,会报如下错误:

将 jdk1.8 升级到 jdk11

上传:

解压:

[root@node01 ~]# cd /opt/modules/
[root@node01 modules]# tar -zxvf jdk-11.0.25_linux-x64_bin.tar.gz -C /opt/installs

重命名:

mv jdk-11.0.25 jdk11

如果以前有安装的 jdk8,先将其重命名:

cd /opt/installs
mv jdk jdk8

做超链接,指向新的 jdk

ln -s jdk11 jdk

同步 jdk11 到 node02,node03 上

xsync.sh /opt/installs/jdk11

将 node02 和 node03 上的 jdk 重命名为 jdk8

mv jdk jdk8

然后在 node01 上同步超链接:

xsync.sh /opt/installs/jdk

在三台电脑上,验证 java 的版本

java -version

上传Flink安装包,解压,配置环境变量

cd /opt/modules
tar -zxf flink-2.0.0-bin-scala_2.12.tgz -C /opt/installs/
cd /opt/installs
mv flink-2.0.0 flink
配置环境变量:
vim /etc/profile.d/custom_env.sh
export FLINK_HOME=/opt/installs/flink
export PATH=$PATH:$FLINK_HOME/bin
export HADOOP_CONF_DIR=/opt/installs/hadoop/etc/hadoop记得source /etc/profile

修改配置文件

① /opt/installs/flink/conf/config.yaml 【以前叫 flink-config.yaml】

yaml 格式检测器:YAML、YML在线编辑(校验、格式化)器工具(无广告) - WGCLOUD

编辑的话,可以使用 idea,由于 yaml 格式非常严格,所以使用 alt+部分选中,进行修改不容易报错

新的配置文件:

参考:OpenEuler部署Flink 1.19.2完全分布式集群_flink1.19部署-CSDN博客

第一步:要把该文件21-24行兼容jdk17的配置删掉或注释掉

第二步:修改其他配置项

jobmanager:bind-host: 0.0.0.0rpc:address: node01# The RPC port where the JobManager is reachable.port: 6123memory:process:# The total process memory size for the JobManager.# Note this accounts for all memory usage within the JobManager process, including JVM metaspace and other overhead.size: 1600mexecution:# The failover strategy, i.e., how the job computation recovers from task failures.# Only restart tasks that may have been affected by the task failure, which typically includes# downstream tasks and potentially upstream tasks if their produced data is no longer available for consumption.failover-strategy: regionarchive:fs:# Directory to upload completed jobs to. Add this directory to the list of# monitored directories of the HistoryServer as well (see below).dir: hdfs://node01:9820/flink/completed-jobs/taskmanager:bind-host: 0.0.0.0host: node01# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.numberOfTaskSlots: 2memory:process:size: 1728mparallelism:# The parallelism used for programs that did not specify and other parallelism.default: 1rest:# The address to which the REST client will connect toaddress: node01bind-address: 0.0.0.0web:submit:# Flag to specify whether job submission is enabled from the web-based# runtime monitor. Uncomment to disable.enable: truecancel:# Flag to specify whether job cancellation is enabled from the web-based# runtime monitor. Uncomment to disable.enable: truehistoryserver:web:# The address under which the web-based HistoryServer listens.address: node01# The port under which the web-based HistoryServer listens.port: 8082archive:fs:# Comma separated list of directories to monitor for completed jobs.dir: hdfs://node01:9820/flink/completed-jobs/# Interval in milliseconds for refreshing the monitored directories.fs.refresh-interval: 10000

完整版的,仅供参考:

################################################################################
#  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.
################################################################################# These parameters are required for Java 17 support.
# They can be safely removed when using Java 8/11.
#  # log4j 2 configuration
#  log:
#    level: TRACE
#    max: 5
#    dir: /tmp/flink_logs#==============================================================================
# Common
#==============================================================================jobmanager:# The host interface the JobManager will bind to. By default, this is localhost, and will prevent# the JobManager from communicating outside the machine/container it is running on.# On YARN this setting will be ignored if it is set to 'localhost', defaulting to 0.0.0.0.# On Kubernetes this setting will be ignored, defaulting to 0.0.0.0.## To enable this, set the bind-host address to one that has access to an outside facing network# interface, such as 0.0.0.0.bind-host: 0.0.0.0rpc:# The external address of the host on which the JobManager runs and can be# reached by the TaskManagers and any clients which want to connect. This setting# is only used in Standalone mode and may be overwritten on the JobManager side# by specifying the --host <hostname> parameter of the bin/jobmanager.sh executable.# In high availability mode, if you use the bin/start-cluster.sh script and setup# the conf/masters file, this will be taken care of automatically. Yarn# automatically configure the host name based on the hostname of the node where the# JobManager runs.address: node01# The RPC port where the JobManager is reachable.port: 6123memory:process:# The total process memory size for the JobManager.# Note this accounts for all memory usage within the JobManager process, including JVM metaspace and other overhead.size: 1600mexecution:# The failover strategy, i.e., how the job computation recovers from task failures.# Only restart tasks that may have been affected by the task failure, which typically includes# downstream tasks and potentially upstream tasks if their produced data is no longer available for consumption.failover-strategy: regionarchive:fs:# Directory to upload completed jobs to. Add this directory to the list of# monitored directories of the HistoryServer as well (see below).dir: hdfs://node01:9820/flink/completed-jobs/taskmanager:# The host interface the TaskManager will bind to. By default, this is localhost, and will prevent# the TaskManager from communicating outside the machine/container it is running on.# On YARN this setting will be ignored if it is set to 'localhost', defaulting to 0.0.0.0.# On Kubernetes this setting will be ignored, defaulting to 0.0.0.0.## To enable this, set the bind-host address to one that has access to an outside facing network# interface, such as 0.0.0.0.bind-host: 0.0.0.0# The address of the host on which the TaskManager runs and can be reached by the JobManager and# other TaskManagers. If not specified, the TaskManager will try different strategies to identify# the address.## Note this address needs to be reachable by the JobManager and forward traffic to one of# the interfaces the TaskManager is bound to (see 'taskmanager.bind-host').## Note also that unless all TaskManagers are running on the same machine, this address needs to be# configured separately for each TaskManager.host: node01# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.numberOfTaskSlots: 2memory:process:# The total process memory size for the TaskManager.## Note this accounts for all memory usage within the TaskManager process, including JVM metaspace and other overhead.# To exclude JVM metaspace and overhead, please, use total Flink memory size instead of 'taskmanager.memory.process.size'.# It is not recommended to set both 'taskmanager.memory.process.size' and Flink memory.size: 1728mparallelism:# The parallelism used for programs that did not specify and other parallelism.default: 1# # The default file system scheme and authority.
# # By default file paths without scheme are interpreted relative to the local
# # root file system 'file:///'. Use this to override the default and interpret
# # relative paths relative to a different file system,
# # for example 'hdfs://mynamenode:12345'
# fs:
#   default-scheme: hdfs://mynamenode:12345#==============================================================================
# High Availability
#==============================================================================# high-availability:
#   # The high-availability mode. Possible options are 'NONE' or 'zookeeper'.
#   type: zookeeper
#   # The path where metadata for master recovery is persisted. While ZooKeeper stores
#   # the small ground truth for checkpoint and leader election, this location stores
#   # the larger objects, like persisted dataflow graphs.
#   #
#   # Must be a durable file system that is accessible from all nodes
#   # (like HDFS, S3, Ceph, nfs, ...)
#   storageDir: hdfs:///flink/ha/
#   zookeeper:
#     # The list of ZooKeeper quorum peers that coordinate the high-availability
#     # setup. This must be a list of the form:
#     # "host1:clientPort,host2:clientPort,..." (default clientPort: 2181)
#     quorum: localhost:2181
#     client:
#       # ACL options are based on https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#sc_BuiltinACLSchemes
#       # It can be either "creator" (ZOO_CREATE_ALL_ACL) or "open" (ZOO_OPEN_ACL_UNSAFE)
#       # The default value is "open" and it can be changed to "creator" if ZK security is enabled
#       acl: open#==============================================================================
# Fault tolerance and checkpointing
#==============================================================================# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled. Checkpointing is enabled when execution.checkpointing.interval > 0.# # Execution checkpointing related parameters. Please refer to CheckpointConfig and CheckpointingOptions for more details.
# execution:
#   checkpointing:
#     interval: 3min
#     externalized-checkpoint-retention: [DELETE_ON_CANCELLATION, RETAIN_ON_CANCELLATION]
#     max-concurrent-checkpoints: 1
#     min-pause: 0
#     mode: [EXACTLY_ONCE, AT_LEAST_ONCE]
#     timeout: 10min
#     tolerable-failed-checkpoints: 0
#     unaligned: false
#     # Flag to enable/disable incremental checkpoints for backends that
#     # support incremental checkpoints (like the RocksDB state backend).
#     incremental: false
#     # Directory for checkpoints filesystem, when using any of the default bundled
#     # state backends.
#     dir: hdfs://namenode-host:port/flink-checkpoints
#     # Default target directory for savepoints, optional.
#     savepoint-dir: hdfs://namenode-host:port/flink-savepoints# state:
#   backend:
#     # Supported backends are 'hashmap', 'rocksdb', or the
#     # <class-name-of-factory>.
#     type: hashmap#==============================================================================
# Rest & web frontend
#==============================================================================rest:# The address to which the REST client will connect toaddress: node01# The address that the REST & web server binds to# By default, this is localhost, which prevents the REST & web server from# being able to communicate outside of the machine/container it is running on.## To enable this, set the bind address to one that has access to outside-facing# network interface, such as 0.0.0.0.bind-address: 0.0.0.0# # The port to which the REST client connects to. If rest.bind-port has# # not been specified, then the server will bind to this port as well.# port: 8081# # Port range for the REST and web server to bind to.# bind-port: 8080-8090web:submit:# Flag to specify whether job submission is enabled from the web-based# runtime monitor. Uncomment to disable.enable: truecancel:# Flag to specify whether job cancellation is enabled from the web-based# runtime monitor. Uncomment to disable.enable: true#==============================================================================
# Advanced
#==============================================================================# io:
#   tmp:
#     # Override the directories for temporary files. If not specified, the
#     # system-specific Java temporary directory (java.io.tmpdir property) is taken.
#     #
#     # For framework setups on Yarn, Flink will automatically pick up the
#     # containers' temp directories without any need for configuration.
#     #
#     # Add a delimited list for multiple directories, using the system directory
#     # delimiter (colon ':' on unix) or a comma, e.g.:
#     # /data1/tmp:/data2/tmp:/data3/tmp
#     #
#     # Note: Each directory entry is read from and written to by a different I/O
#     # thread. You can include the same directory multiple times in order to create
#     # multiple I/O threads against that directory. This is for example relevant for
#     # high-throughput RAIDs.
#     dirs: /tmp# classloader:
#   resolve:
#     # The classloading resolve order. Possible values are 'child-first' (Flink's default)
#     # and 'parent-first' (Java's default).
#     #
#     # Child first classloading allows users to use different dependency/library
#     # versions in their application than those in the classpath. Switching back
#     # to 'parent-first' may help with debugging dependency issues.
#     order: child-first# The amount of memory going to the network stack. These numbers usually need
# no tuning. Adjusting them may be necessary in case of an "Insufficient number
# of network buffers" error. The default min is 64MB, the default max is 1GB.
#
# taskmanager:
#   memory:
#     network:
#       fraction: 0.1
#       min: 64mb
#       max: 1gb#==============================================================================
# Flink Cluster Security Configuration
#==============================================================================# Kerberos authentication for various components - Hadoop, ZooKeeper, and connectors -
# may be enabled in four steps:
# 1. configure the local krb5.conf file
# 2. provide Kerberos credentials (either a keytab or a ticket cache w/ kinit)
# 3. make the credentials available to various JAAS login contexts
# 4. configure the connector to use JAAS/SASL# # The below configure how Kerberos credentials are provided. A keytab will be used instead of
# # a ticket cache if the keytab path and principal are set.
# security:
#   kerberos:
#     login:
#       use-ticket-cache: true
#       keytab: /path/to/kerberos/keytab
#       principal: flink-user
#       # The configuration below defines which JAAS login contexts
#       contexts: Client,KafkaClient#==============================================================================
# ZK Security Configuration
#==============================================================================# zookeeper:
#   sasl:
#     # Below configurations are applicable if ZK ensemble is configured for security
#     #
#     # Override below configuration to provide custom ZK service name if configured
#     # zookeeper.sasl.service-name: zookeeper
#     #
#     # The configuration below must match one of the values set in "security.kerberos.login.contexts"
#     login-context-name: Client#==============================================================================
# HistoryServer
#==============================================================================# The HistoryServer is started and stopped via bin/historyserver.sh (start|stop)
#
# jobmanager:
#   archive:
#     fs:
#       # Directory to upload completed jobs to. Add this directory to the list of
#       # monitored directories of the HistoryServer as well (see below).
#       dir: hdfs:///completed-jobs/historyserver:web:# The address under which the web-based HistoryServer listens.address: node01# The port under which the web-based HistoryServer listens.port: 8082archive:fs:# Comma separated list of directories to monitor for completed jobs.dir: hdfs://node01:9820/flink/completed-jobs/# Interval in milliseconds for refreshing the monitored directories.fs.refresh-interval: 10000

② /opt/installs/flink/conf/masters

node01:8081

③ /opt/installs/flink/conf/workers

node01
node02
node03

上传jar包

将资料下的flink-shaded-hadoop-2-uber-2.7.5-10.0.jar放到flink的lib目录下

分发

xsync.sh /opt/installs/flink
xsync.sh /etc/profile.d/custom_env.sh

去 node02 和 node03 上修改一个主机名:

修改 node02 和 node03 上的 taskmanager 中的 host 为 node02 和 node03

启动

#启动HDFS  
start-dfs.sh
#启动集群
start-cluster.sh
#启动历史服务器
historyserver.sh start

假如 historyserver 无法启动,也就没有办法访问 8082 服务,原因大概是你没有上传 关于 hadoop 的 jar 包到 lib 下:

观察webUI

http://node01:8081   -- Flink集群管理界面    当前有效,重启后里面跑的内容就消失了
能够访问8081是因为你的集群启动着呢
http://node01:8082   -- Flink历史服务器管理界面,及时服务重启,运行过的服务都还在
能够访问8082是因为你的历史服务启动着

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/79162.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

android11 配置默认电池优化白名单

目录 1.介绍 2.读取配置文件 3.默认配置一个白名单列表 1.介绍 在 Android 11 中,DeviceIdleController 是负责控制设备进入 Doze 模式(闲置模式) 的核心系统服务,其内部方法 readConfigFileLocked() 负责从配置文件中读取 Doze 模式的行为参数,包括 idle 阶段的时间间…

java中的Future的设计模式 手写一个简易的Future

案例 例如&#xff1a;今天是小妹的生日&#xff0c;需要一个蛋糕有点仪式感&#xff0c;于是去蛋糕店预定&#xff0c;预定完之后&#xff0c;店老板说蛋糕做好了&#xff0c;到时电话通知你&#xff0c;不可能在这傻傻的等着吧&#xff0c;还有其他事情要做啊&#xff0c;于…

【Redis】Redis C++使用

一、Redis的自定义网络协议 1.1 为什么可以编写出一个自定义的Redis客户端 为什么我们可以编写出一个自定义的Redis客户端&#xff1f;因为Redis公开了自己的自定义协议。而对于一些其他软件的客户端&#xff0c;我们无法编写出一个自定义的Redis客户端&#xff0c;因为他们没…

【软考系统架构设计师】软件工程知识点

1、 软件开发生命周期 软件定义时期&#xff1a;包括可行性研究和详细需求分析过程&#xff0c;任务是确定软件开发工程必须完成的总目标&#xff0c;具体分为问题定义、可行性研究、需求分析等 软件开发时期&#xff1a;软件的设计与实现&#xff0c;分为概要设计、详细设计、…

DeepSeek 与开源:肥沃土壤孕育 AI 硕果

当国产 AI DeepSeek 以其低成本推理和多模态能力在全球范围内引起轰动时&#xff0c;人们惊叹于中国技术的迅猛发展&#xff0c;却很少有人深究这一成就背后的根基。答案其实早已写在中国开源生态二十多年的发展历程中。 从倪光南院士提出“以开源打破技术垄断”的理念&#x…

职坐标:智慧城市未来发展的核心驱动力

内容概要 智慧城市的演进正以颠覆性创新重构人类生存空间&#xff0c;其发展脉络由物联网、人工智能与云计算三大技术支柱交织而成。这些技术不仅推动城市治理从经验决策转向数据驱动模式&#xff0c;更通过实时感知与智能分析&#xff0c;实现交通、能源等领域的精准调控。以…

vue复习46~90

1.小兔鲜 所有都折叠 ctrl k,ctrl0 所有都展开 ctrl k,ctrlj当前结构渲染5次 <BaseBrandItem v-for"item in 5" :key"item"><BaseBrandItem>2.scoped样式冲突 结构&#xff1a;只能有一个根元素样式&#xff1a;全局样式(默认)&#xff1…

PHP 用 workman 即时通讯,做个简版QQ

1. workman是什么 &#xff0c;一般应用在那些地方 workerman是一个高性能的PHP socket 服务器框架&#xff0c;workerman基于PHP多进程以及libevent事件轮询库&#xff0c;PHP开发者只要实现一两个接口&#xff0c;便可以开发出自己的网络应用&#xff0c;例如Rpc服务、聊天室…

【WORD】批量将doc转为docx

具体步骤进行&#xff1a; 打开Word文档&#xff0c;按下AltF11快捷键&#xff0c;打开VBA编辑器。在VBA编辑器中&#xff0c;左侧的“项目资源管理器”窗口会显示当前打开的Word文档相关项目。找到您要添加代码的文档项目&#xff08;通常以文档名称命名&#xff09;&#xf…

【免费】【实测有用】5KPlayer Windows 电脑作为 MacBook 无线扩展屏

总结&#xff1a;使用 5KPlayer 将 Windows 电脑作为 MacBook 无线扩展屏 准备工作 设备要求&#xff1a; MacBook 和 Windows 电脑需连接到同一 Wi-Fi 网络。【这里有雷&#xff1a;eduroam不会成功&#xff0c;家里的WIFI成功了&#xff0c;需要确认校园网是否可行。】确保…

华为华三模拟器解决兼容问题Win11 24H2 现在使用ENSP的问题解决了

一、Win11 24H2 现在使用ENSP的问题解决了 这个Win11 的 24H2不能使用ENSP的问题已经困扰我们很久了,在之前的文章中,我们也有说明这个问题 之前ENSP肯定启动会报错40 当时还建议大家先不要更新到win11的24H2版本,现在终于迎来了更新,不用再担心了,包括早就升级了24H2版…

嵌入式WebRTC轻量化SDK压缩至500K-800K ,为嵌入式设备节省Flash资源

一、SDK轻量化的核心技术实现 1、WebRTC库裁剪与模块化设计 EasyRTC针对嵌入式设备的资源限制&#xff0c;对原生WebRTC库进行深度裁剪&#xff0c;仅保留核心通信功能&#xff08;如信令管理、编解码、网络传输等&#xff09;&#xff0c;移除冗余组件&#xff08;如部分调试…

Maya云渲染工作流,提升渲染速度

在三维动画与影视特效领域&#xff0c;Autodesk Maya作为行业标杆工具&#xff0c;承载着从角色建模到复杂特效渲染的全流程创作。然而&#xff0c;本地硬件性能不足、渲染周期漫长、跨团队协作效率低等痛点始终困扰着创作者。渲染101云渲染以弹性算力资源、智能化工作流与全方…

git怎么使远程分支回退到指定的节点处

git使远程分支回退到指定的节点 引言场景描述步骤 引言 最近提交代码的时候&#xff0c;总将分支合并错&#xff0c;原本要合到A分支&#xff0c;结果合并到了B分支&#xff0c;这样就导致b分支需要回退到我没有合并之前的节点处。 本文记录下怎么将远程分支回退到指定的节点。…

全网通emotn ui桌面免费吗?如何开机自启动

在智能设备的使用中&#xff0c;一款优秀的桌面系统能带来截然不同的体验。全网通Emotn UI桌面便是其中的佼佼者&#xff0c;它以完全免费的特性与卓越性能&#xff0c;成为众多用户的心头好。 其简洁美观的界面设计如同为设备换上"清新外衣"&#xff0c;常用功能一…

通过微信APPID获取小程序名称

进入微信公众平台&#xff0c;登录自己的小程序后台管理端&#xff0c;在“账号设置”中找到“第三方设置” 在“第三方设置”页面中&#xff0c;将页面拉到最下面&#xff0c;即可通过appid获取到这个小程序的名称信息

2025年第十六届蓝桥杯省赛JavaB组真题回顾

第16届蓝桥杯省赛已经结束了&#xff0c;第一次参加也是坐牢了4个小时&#xff0c;现在还是来总结一下吧&#xff08;先声明以下的解法&#xff0c;大家可以当作一种思路来看&#xff0c;解法不一定是正解&#xff0c;只是给大家提供一种能够正常想到的思路吧&#xff09; 试题…

深入剖析 Axios 的 POST 请求:何时使用 qs 处理数据

在前端开发中&#xff0c;Axios 是一个广泛使用的用于发送 HTTP 请求的库&#xff0c;特别是在处理 POST 请求时&#xff0c;数据的处理方式会直接影响到请求能否正确被后端接收和处理。其中&#xff0c;使用 qs 库对数据进行处理是一个常见的操作点&#xff0c;本文将深入探讨…

通过websocket给服务端发送订单催单提醒消息

controller层 GetMapping("/reminder/{id}")public Result Remainder(PathVariable("id") Long id){orderService.remainder(id);return Result.success();} 实现类 Overridepublic void remainder(Long id) {Orders ordersDB orderMapper.getById(id);…

ros_note02

note02 节点 ROS2中每一个节点只负责一个单独的模块化功能 如&#xff1a;一个节点负责控制车轮转动&#xff0c;一个节点负责从激光雷达获取数据&#xff0c;一个节点负责定位 通信方式&#xff1a; 话题&#xff1a;topic服务&#xff1a;services动作&#xff1a;Actio…