Flink本地Idea调试源码环境搭建

1.1 下载源码并编译

git clone https://github.com/apache/flink.git

cd flink

git checkout -b dev-1.14 remotes/origin/release-1.14

mvn clean install -DskipTests -Dfast

1.2 启动JobManager

入口类为:

org.apache.flink.runtime.entrypoint.StandaloneSessionClusterEntrypoint

在Run Configurations配置界面配置以下内容:

-- vm options
-Dlog.file=/Users/jordan95225/IdeaProjects/source_code/flink/build-target/log/flink-jobmanager-1.local.log
-Dlog4j.configuration=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/log4j.properties 
-Dlog4j.configurationFile=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/log4j.properties 
-Dlogback.configurationFile=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/logback.xml

-classpath :/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-dist_2.11-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-table_2.11-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-csv-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-json-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-shaded-zookeeper-3.4.14.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-1.2-api-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-api-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-core-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-slf4j-impl-2.17.1.jar

-- program arguments
-c /Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf

如下图所示:

image-20220321221115435

启动之后可以在http://localhost:8081/查看是否启动成功

1.3 启动TaskManager

入口类为:

org.apache.flink.runtime.taskexecutor.TaskManagerRunner

配置同JobManager:

-- vm options
-Dlog.file=/Users/jordan95225/IdeaProjects/source_code/flink/build-target/log/flink-taskexecutor-1.local.log 
-Dlog4j.configuration=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/log4j.properties 
-Dlog4j.configurationFile=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/log4j.properties 
-Dlogback.configurationFile=file:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf/logback.xml

-classpath :/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-dist_2.11-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-table_2.11-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-csv-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-json-1.14-SNAPSHOT.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/flink-shaded-zookeeper-3.4.14.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-1.2-api-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-api-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-core-2.17.1.jar:/Users/jordan95225/IdeaProjects/source_code/flink/build-target/lib/log4j-slf4j-impl-2.17.1.jar

-- program arguments
-c /Users/jordan95225/IdeaProjects/source_code/flink/build-target/conf
-D taskmanager.memory.framework.off-heap.size=134217728b 
-D taskmanager.memory.network.max=134217730b 
-D taskmanager.memory.network.min=134217730b 
-D taskmanager.memory.framework.heap.size=134217728b 
-D taskmanager.memory.managed.size=536870920b 
-D taskmanager.cpu.cores=4
-D taskmanager.memory.task.heap.size=402653174b 
-D taskmanager.memory.task.off-heap.size=0b 
-D taskmanager.memory.jvm-metaspace.size=268435456b 
-D taskmanager.memory.jvm-overhead.max=201326592b 
-D taskmanager.memory.jvm-overhead.min=201326592b

如下图所示:

image-20220321221530120

posted @ 2022-03-21 23:15  马晟  阅读(898)  评论(0编辑  收藏  举报