docker-compose快速部署flink1.18.1

也曾少年發表於2024-09-14

目的

用於規範flink元件的部署操作,可用於開發測試環境快速部署

前置條件

基於centos7

例項名 內網IP 主機名(Hostname) 角色
例項1 172.20.20.2 test-20-2 節點1

開始部署

1.提前準備好flink:1.18.1映象

docker pull flink:1.18.1

部署目錄:

/app/funo/flink

2.docker-compose.yml容器編排檔案如下:

version: "2.2"
services:
  jobmanager:
    image: registry.us-east-1.aliyuncs.com/oll/flink:1.18.1
    expose:
      - "6123"
    ports:
      - "48809:8081"
      - "6123:6123"
    command: jobmanager
    volumes:
      - ./job/artifacts:/opt/flink/usrlib
    environment:
      - TZ:Asia/Shanghai
      - |
        FLINK_PROPERTIES=
        jobmanager.rpc.address: jobmanager
        parallelism.default: 4
    privileged: true
  taskmanager:
    image: registry.us-east-1.aliyuncs.com/oll/flink:1.18.1
    depends_on:
      - jobmanager
    command: taskmanager
    expose:
      - "6121"
      - "6122"
    scale: 2
    volumes:
      - ./job/artifacts:/opt/flink/usrlib
      #- /app/funo/flink/conf:/opt/flink/conf:rw
    environment:
      - TZ:Asia/Shanghai
      - |
        FLINK_PROPERTIES=
        jobmanager.rpc.address: jobmanager
        taskmanager.numberOfTaskSlots: 4
        parallelism.default: 4
    privileged: true


3.配置目錄賦權

chwon -R 9999.9999 /app/funo/flink/

4.啟動命令:

docker-compose -f docker-compose.yaml up -d
docker-compose -f docker-compose.yaml ps
docker-compose -f docker-compose.yaml logs --tail=100 -f

相關文章