通过Docker一键搭建,以下是模板。
version: '3.1'
services:
jobmanager:
image: flink:latest
ports:
- "8081:8081"
command: jobmanager
volumes:
- ./jobs:/opt/flink/jobs:rw
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
deploy:
resources:
limits:
cpus: "2.00"
memory: 4G
taskmanager:
image: flink:latest
depends_on:
- jobmanager
command: taskmanager
scale: 2
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
taskmanager.numberOfTaskSlots: 2
deploy:
resources:
limits:
cpus: "2.00"
memory: 4G
遇到的坑1、class传参问题
【错误】./bin/flink run ./jobs/flinkpgsql-1.0-SNAPSHOT-jar-with-dependencies.jar -c cn.sdust.jtyhzl.packingcnt.ParkingCnt
【正确】./bin/flink run -c cn.sdust.jtyhzl.packingcnt.ParkingCnt ./jobs/flinkpgsql-1.0-SNAPSHOT-jar-with-dependencies.jar
【结论】 flink run 传参只能放脚本地址前面。