报错日志
这是flink-cluster-jobmanager-1报错日志
2023-12-07 23:34:26 [ERROR] The execution result is empty.
2023-12-07 23:34:25 Starting Job Manager
2023-12-07 23:34:26 [ERROR] Could not get JVM parameters and dynamic configurations properly.
2023-12-07 23:34:26 [ERROR] Raw output from BashJavaUtils:
2023-12-07 23:34:26 INFO [] - Loading configuration property: jobmanager.rpc.address, jobmanager
2023-12-07 23:34:26 INFO [] - Loading configuration property: blob.server.port, 6124
2023-12-07 23:34:26 INFO [] - Loading configuration property: query.server.port, 6125
2023-12-07 23:34:26 INFO [] - Loading configuration property: query.server.port, 6125
2023-12-07 23:34:26 Exception in thread "main" org.apache.flink.configuration.IllegalConfigurationException: JobManager memory configuration failed: Either required fine-grained memory (jobmanager.memory.heap.size), or Total Flink Memory size (Key: 'jobmanager.memory.flink.size' , default: null (fallback keys: [])), or Total Process Memory size (Key: 'jobmanager.memory.process.size' , default: null (fallback keys: [])) need to be configured explicitly.
2023-12-07 23:34:26 at org.apache.flink.runtime.jobmanager.JobManagerProcessUtils.processSpecFromConfigWithNewOptionToInterpretLegacyHeap(JobManagerProcessUtils.java:78)
2023-12-07 23:34:26 at org.apache.flink.runtime.util.bash.BashJavaUtils.getJmResourceParams(BashJavaUtils.java:98)
2023-12-07 23:34:26 at org.apache.flink.runtime.util.bash.BashJavaUtils.runCommand(BashJavaUtils.java:69)
2023-12-07 23:34:26 at org.apache.flink.runtime.util.bash.BashJavaUtils.main(BashJavaUtils.java:56)
2023-12-07 23:34:26 Caused by: org.apache.flink.configuration.IllegalConfigurationException: Either required fine-grained memory (jobmanager.memory.heap.size), or Total Flink Memory size (Key: 'jobmanager.memory.flink.size' , default: null (fallback keys: [])), or Total Process Memory size (Key: 'jobmanager.memory.process.size' , default: null (fallback keys: [])) need to be configured explicitly.
2023-12-07 23:34:26 at org.apache.flink.runtime.util.config.memory.ProcessMemoryUtils.failBecauseRequiredOptionsNotConfigured(ProcessMemoryUtils.java:129)
2023-12-07 23:34:26 at org.apache.flink.runtime.util.config.memory.ProcessMemoryUtils.memoryProcessSpecFromConfig(ProcessMemoryUtils.java:86)
2023-12-07 23:34:26 at org.apache.flink.runtime.jobmanager.JobManagerProcessUtils.processSpecFromConfig(JobManagerProcessUtils.java:83)
2023-12-07 23:34:26 at org.apache.flink.runtime.jobmanager.JobManagerProcessUtils.processSpecFromConfigWithNewOptionToInterpretLegacyHeap(JobManagerProcessUtils.java:73)
2023-12-07 23:34:26 ... 3 more
解决方法
错误消息指出了两个问题:
1. 配置中的 JVM Overhead 大小不在允许的范围内。
2. 需要明确设置 JobManager 的内存配置。
对于第一个问题,`Derived JVM Overhead size (128.000mb)` 不在配置的范围 `[192.000mb, 1024.000mb]` 内。这意味着我们需要调整 JobManager 的内存配置,以确保 JVM Overhead 在允许的范围内。
对于第二个问题,错误消息建议我们需要明确设置 JobManager 的内存配置。我们需要确保在 `flink-conf.yaml` 中明确设置了 `jobmanager.memory.flink.size` 或 `jobmanager.memory.process.size`。
基于这些信息,这里是一个更新后的 `flink-conf.yaml` 配置示例,其中包括了对 JVM Overhead 的配置:
```yaml
jobmanager.rpc.address: jobmanager
jobmanager.rpc.port: 6123
blob.server.port: 6124
query.server.port: 6125
jobmanager.memory.process.size: 1600m # 增加 JobManager 进程内存大小以满足 JVM Overhead 要求
jobmanager.memory.heap.size: 1024m # 增加 JobManager 堆内存大小
taskmanager.memory.process.size: 1728m
taskmanager.memory.managed.size: 512m
taskmanager.numberOfTaskSlots: 2
parallelism.default: 2
```
在这个配置中,我增加了 `jobmanager.memory.process.size` 到 `1600m` 以确保 JVM Overhead 在 `[192mb, 1024mb]` 的范围内。同时,我也增加了 `jobmanager.memory.heap.size` 到 `1024m`。
请根据您的实际需要调整这些值,这只是一个示例。
完成这些更改后,您需要重新启动 Docker Compose 服务:
```bash
docker-compose down
docker-compose up -d
```
确保 Docker Compose 配置文件中没有设置 `FLINK_PROPERTIES` 环境变量,因为我们已经在 `flink-conf.yaml` 文件中直接提供了所有必要的配置。如果您仍然遇到问题,请检查您的 `flink-conf.yaml` 文件是否正确挂载到了容器中,并且没有语法错误。
配置文件
version: '2.4'
networks:
flink-net:
services:
jobmanager:
image: flink:1.14.0
command: jobmanager
ports:
- 8081:8081
volumes:
- D:/flink/conf:/opt/flink/conf
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- JOB_MANAGER_RPC_PORT=6123
- KAFKA_BROKERS=kafka1:9092,kafka2:9093,kafka3:9094
networks:
- flink-net
taskmanager1:
image: flink:1.14.0
command: taskmanager
depends_on:
- jobmanager
volumes:
- D:/flink/conf:/opt/flink/conf
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- JOB_MANAGER_RPC_PORT=6123
networks:
- flink-net
taskmanager2:
image: flink:1.14.0
command: taskmanager
depends_on:
- jobmanager
volumes:
- D:/flink/conf:/opt/flink/conf
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- JOB_MANAGER_RPC_PORT=6123
networks:
- flink-net
taskmanager3: # 新增加的 TaskManager 服务
image: flink:1.14.0
command: taskmanager
depends_on:
- jobmanager
volumes:
- D:/flink/conf:/opt/flink/conf
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- JOB_MANAGER_RPC_PORT=6123
networks:
- flink-net
D:\flink\conf
jobmanager.rpc.address: jobmanager
jobmanager.rpc.port: 6123
blob.server.port: 6124
query.server.port: 6125
jobmanager.memory.process.size: 1600m # 增加 JobManager 进程内存大小以满足 JVM Overhead 要求
jobmanager.memory.heap.size: 1024m # 增加 JobManager 堆内存大小
taskmanager.memory.process.size: 1728m
taskmanager.memory.managed.size: 512m
taskmanager.numberOfTaskSlots: 2
parallelism.default: 2