赞
踩
https://edu.csdn.net/course/detail/39418
核心点:教会大家如何编译flink以及本地运行Standalone
该文档适用于flink1.19 flink1.18编译
本节课
idea(intelliJ IDEA 2023.3.4)
git(Git-2.34.1-64-bit.exe)
maven(3.8.8)
jdk(1.8)
scala(2.12.7)
下载代码请复制以下命令到终端执行(本地需要安装git)
git clone https://gitee.com/apache/flink.git
2.1.2 idea方式
idea打开项目修改一下Maven下载路径,默认下载到C盘
2.1.5.设置scala版本
等待Clean执行完成
Install
创建两个文件夹a_lib、a_conf,方便后面使用
源码编译完毕后在flink-dist下会有配置文件以及编译后的jar包
将F:\new2\flink\flink-dist\target\flink-1.18-SNAPSHOT-bin\flink-1.18-SNAPSHOT\lib,lib下的13个jar拷贝到我们创建的a_lib下
将F:\new2\flink\flink-dist\target\flink-1.18-SNAPSHOT-bin\flink-1.18-SNAPSHOT\conf下的配置文件拷贝到我们创建的a_conf下
################################################################################ env.java.opts.all: --add-exports=java.base/sun.net.util=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED jobmanager.rpc.address: localhost # The RPC port where the JobManager is reachable. jobmanager.rpc.port: 6123 jobmanager.bind-host: localhost jobmanager.memory.process.size: 1600m taskmanager.bind-host: localhost #唯一标识 window下必须配置 taskmanager.resource-id: q1 taskmanager.cpu.cores: 1 #任务的堆内存 taskmanager.memory.task.heap.size: 512m #托管内存 taskmanager.memory.managed.size: 512m #网络内存(Network Memory) taskmanager.memory.network.min: 128m taskmanager.memory.network.max: 128m #任务堆外内存 taskmanager.memory.task.off-heap.size: 0m #框架内存 taskmanager.memory.framework.heap.size: 256m #框架堆外内存 taskmanager.memory.framework.off-heap.size: 128m #JVM Metaspace taskmanager.memory.jvm-metaspace.size: 128m #JVM 开销 taskmanager.memory.jvm-overhead.min: 128m taskmanager.memory.jvm-overhead.max: 128m #心跳参数 heartbeat.timeout: 50000 heartbeat.interval: 10000 taskmanager.host: localhost taskmanager.memory.process.size: 1728m taskmanager.numberOfTaskSlots: 1 # The parallelism used for programs that did not specify and other parallelism. parallelism.default: 1 jobmanager.execution.failover-strategy: region rest.address: localhost rest.bind-address: localhost
ctrl+n 搜索 StandaloneSessionClusterEntrypoint类
2.1.设置参数
添加-c a_conf配置
-c a_conf
添加log配置
-Dlog.file=./log/flink-jobmanager-1.local.log -Dlog4j.configuration=./a_conf/log4j.properties -Dlog4j.configurationFile=./a_conf/log4j.properties -Dlogback.configurationFile=./a_conf/logback.xml
添加依赖包
启动StandaloneSessionClusterEntrypoint类
ctrl+n 搜索 TaskManagerRunner类
5.1.设置参数
添加-c a_conf配置
-c a_conf
添加log配置
-Dlog.file=./log/flink-taskmanager-1.local.log -Dlog4j.configuration=./a_conf/log4j.properties -Dlog4j.configurationFile=./a_conf/log4j.properties -Dlogback.configurationFile=./a_conf/logback.xml
添加依赖包
启动TaskManagerRunner类
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。