Docker中flink-cluster-jobmanager-1运行失败解决方法

文章描述了一则Flink集群JobManager启动时遇到的报错,主要问题是JVM参数配置不正确以及JobManager内存配置缺失。解决方法涉及调整JVMOverhead和明确设置jobmanager.memory配置。
摘要由CSDN通过智能技术生成

报错日志

这是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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值