flink-1.10 统一作业提交逻辑

Flink 1.10通过FLIP-73、FLIP-81和FLINK-74解决了作业提交的环境绑定问题,统一了Executor接口,允许通过-D参数动态指定配置,减少了维护的复杂性。JobClient API的引入方便了作业管理和下游工具的开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


flink-1.10 之前,任务提交通常遇到以下问题:

  • 任务提交由 Execution Environments 负责,并且和部署的环境(yarn k8s mesos)高度绑定,导致最终 Execution Environments 的数量很多,用户针对不同环境需要维护的配置很多,代码复用度比较低。
  • 用户需要针对不同的 job 维护不同的 flink-conf.yaml 配置文件,不能像 spark 那样通过 —D 参数动态指定
  • 用户获取 flink 作业信息只能通过 REST API,下游工具不能很方便的适配

flink-1.10 通过以下 3 个 Flip 解决上述问题

1.FLIP-73 : 通用的 Executor 接口

FLIP-73 中给出以下公式:

最终的 Execution Environments 数量 = API 数量(batch, streaming) × 部署环境数量(local, remote, collection, cli/context) + ε(optimizedPlan, previewPlan)

以 streaming api 对应的 StreamExecutionEnvironment 为例,有以下子类:
在这里插入图片描述
StreamExecutionEnvironment 类的 execute() 方法声明为 abstract,每个子类需要实现各自的 execute() 方法

public abstract JobExecutionResult execute(StreamGraph streamGraph) throws Exception;

在 Flink 1.10 中,作业提交逻辑被抽象到了通用的 Executor 接口 (PipelineExecutor)(FLIP-73).

// PipelineExecutor.java
/**
 * The entity responsible for executing a {@link Pipeline}, i.e. a user job.
 */
@Internal
public interface PipelineExecutor {
   
   

	/**
	 * Executes a {@link Pipeline} based on the provided configuration and returns a {@link JobClient} which allows to
	 * interact with the job being executed, e.g. cancel it or take a savepoint.
	 *
	 * <p><b>ATTENTION:</b> The caller is responsible for managing the lifecycle of the returned {@link JobClient}. This
	 * means that e.g. {@code close()} should be called explicitly at the call-site.
	 *
	 * @param pipeline the {@link Pipeline} to execute
	 * @param configuration the {@link Configuration} with the required execution parameters
	 * @return a {@link CompletableFuture} with the {@link JobClient} corresponding to the pipeline.
	 */
	CompletableFuture<JobClient> execute(final Pipeline pipeline, final Configuration configuration) 
### 关于Flink 1.3.6 和 Flink-CDC 2.2 的集成与兼容性 对于 Flink 1.3.6 版本而言,其属于较早版本的 Apache Flink,在功能支持以及与其他工具的集成方面存在一定的局限性。具体到 Flink-CDC 2.2 集成时,需要注意以下几点: #### 1. **Flink CDC 的最低版本需求** Flink-CDC 是一个用于捕获变更数据并将其流式传输至下游系统的框架。然而,Flink-CDC 2.x 系列通常依赖更高版本的 Flink 运行环境(通常是 Flink 1.10 或以上)。由于 Flink 1.3.6 属于早期版本,可能无法满足 Flink-CDC 所需的核心库接口和 API 支持的要求[^2]。 #### 2. **Java SDK 兼容性问题** 正如提到的 Hadoop-JDK 兼容性矩阵所示,不同 Java 版本可能会引入不向后兼容的变化。如果运行环境中使用的 JDK 版本较高,则可能导致某些内部机制失效。因此,在尝试将 Flink 1.3.6 与 Flink-CDC 2.2 结合使用之前,应确认所选 JDK 是否能够适配这两个组件的需求[^1]。 #### 3. **API 差异引发的功能缺失** Flink 1.3.6 中的数据源定义方式、状态管理策略以及其他核心特性相较于后续版本有显著差异。而这些变化直接影响到了像 Flink-CDC 这样基于最新版设计开发的应用程序能否正常工作。例如,Flink-CDC 可能会利用 Table/SQL 接口来简化配置流程,但在旧版本中该部分尚未完善[^3]。 ```java // 示例代码展示如何通过Table API设置CDC连接器(仅适用于新版本) tableEnv.executeSql(""" CREATE TABLE mysql_binlog ( id BIGINT, name STRING, age INT, proc_time AS PROCTIME() ) WITH ( 'connector' = 'mysql-cdc', 'hostname' = 'localhost', 'port' = '3306', 'username' = 'root', 'password' = '', 'database-name' = 'test_db', 'table-name' = 'users' ) """); ``` 上述代码片段展示了现代 Flink 使用 MySQL Binlog Connector 设置表的方式,但此方法并不适合应用于非常老旧如 v1.3.x 的发行版上[^4]。 --- ### 总结建议 鉴于当前情况,强烈推荐升级基础架构中的主要软件包——即把 Flink 升级到至少 1.10+ 后再考虑接入最新的 Flink-CDC 功能模块。这样不仅可以获得更好的性能表现还能规避因跨代组合带来的潜在风险。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值