• Flink 集群部署


    Flink 集群部署

    Flink 集群部署分类

    根据以下两种条件将集群部署模式分为三种类型:

    1、集群的生命周期和资源隔离;

    2、根据程序main()方法执行在Client 还是JobManager

    • Session Mode
      • 共享JobManager 和TaskManager,所有提交的Job都在一个Runtime中运行
    • Pre-Job Mode
      • 独享JobManager 和TaskManager,好比为每个Job单独启动一个Runtime
    • Application Mode (1.11版本提出)
      • Application的main()运行在Cluster上,而不在客户端
      • 每个Application对应一个Runtime,Application中可以包含有多个Job

    Flink支持资源管理器

    • Standalone
    • Hadoop Yarn
    • Apache Mesos
    • Docker
    • Kubernetes
    Cluster ManagementSession 模式Pre-Job模式Application 模式Native 模式是否生产可用是否支持高可用国内接受度
    Local支持不支持不支持不支持不支持
    Standalone支持不支持不支持不支持支持
    Yarn支持支持支持支持支持
    Mesos支持支持不支持支持支持
    Docker支持支持不支持不支持不支持
    Kubernetes支持支持支持支持支持

    Standalone

    单机

    https://flink.apache.org/downloads.html

    wget https://dlcdn.apache.org/flink/flink-1.16.0/flink-1.16.0-bin-scala_2.12.tgz
    tar -zxvf flink-1.16.0-bin-scala_2.12.tgz
    cd flink-1.16.0 & ./bin/start-cluster.sh
    
    • 1
    • 2
    • 3

    多机

    修改 conf/flink-conf.yaml:
    high-availability: zookeeper
    high-availability.zookeeper.quorum: node01:2181,node02:2181,node03:2181,node04:2181,node05:2181 
    high-availability.zookeeper.path.root: /flink 
    #high-availability.cluster-id: /cluster_one # important: customize per cluster 
    high-availability.storageDir: hdfs:///flink/recovery
    
    • 1
    • 2
    • 3
    • 4
    • 5
    配置 conf/masters:
    localhost:8081 
    localhost:8082
    
    • 1
    • 2
    配置 conf/zoo.cfg(可选):
    server.0=localhost:2888:3888
    
    • 1
    启动 HA 集群
    $ bin/start-cluster.sh 
    Starting HA cluster with 2 masters and 1 peers in ZooKeeper quorum. 
    Starting standalonesession daemon on host localhost. 
    Starting standalonesession daemon on host localhost. 
    Starting taskexecutor daemon on host localhost.
    
    • 1
    • 2
    • 3
    • 4
    • 5

    Yarn

    Session 集群启动:

    ./bin/yarn-session.sh -jm 1024m -tm 4096m
    
    • 1

    Job 集群启动:

    ./bin/flink run -m yarn-cluster -p 4 -yjm 1024m -ytm 4096m ./examples/batch/WordCout.jar
    
    • 1

    Application Mode集群启动:

    ./bin/flink run-application -t yarn-application \
    -Djobmanager.memory.process.size=2048m \
    -Dtaskmanager.memory.process.size=4096m \
    -Dyarn.provided.lib.dirs="hdfs://node02:8020/flink-training/flink-1.16.0" \
    ./MyApplication.jar
    
    • 1
    • 2
    • 3
    • 4
    • 5
  • 相关阅读:
    Prompt Engineering(提示工程)
    Java文件流练习
    万界星空科技MES系统中的车间管理的作用
    力扣刷题之求两数之和
    分类预测 | MATLAB实现SSA-FS-SVM麻雀算法同步优化特征选择结合支持向量机分类预测
    EFCore 使用FluntApi配置 全局查询筛选器
    Nginx正则表达式、location匹配、rewrite重写
    el-date-picker 禁用时分秒选择(包括禁用下拉框展示)
    安卓掌读小说v1.5.8破解版免费分享
    【C++入门系列】——类和对象
  • 原文地址:https://blog.csdn.net/FFFSSSFFF6/article/details/127898522