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.pswp.cn/diannao/79162.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/79162.shtml
英文地址,請注明出處:http://en.pswp.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…