如何在Flink中引用外部Jar [英] How to Reference the External Jar in Flink

查看:2578
本文介绍了如何在Flink中引用外部Jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人.我试图通过将其复制到所有任务管理器中的$ FLINK/lib的方式在Flink中引用我的公司jar,但是失败了.而且我也不想包装一个胖胖的罐子,这太重了,浪费时间.我认为第一种方法也不是一个好主意,因为我必须管理整个集群中的jars.任何人都知道如何解决这个问题?任何建议将不胜感激.

everyone. I tried to reference my company jar in Flink in the way of copying it to $FLINK/lib in all of taskmanagers, but failed. And I don't want to package a fat jar, which is too heavy and waste of time. I think the first method is also not a good idea, because I have to manager jars in the whole cluster. Anyone kowns how to resolve this problem? Any suggestion would be appreciated.

推荐答案

通常,构建一个胖子罐是最好的方法.不确定远罐有多大,您认为它太重了?

In general, building a fat jar is the best way to go. Not sure how big your far jar gets, that you thinks it is "too heavy"?

将jar复制到$FLINK/lib应该可以.但是,您需要重新启动Flink,以便将jar添加到Flink的类路径中.因此,这种方法不允许动态添加jar,但是它应适用于一堆稳定的jar.

Copying jars to $FLINK/lib should work. However, you need to restart Flink such that the jars are added to Flink's classpath. Thus, this approach does not allow to dynamically add jars -- it should work for a bunch of stable jars however.

为了管理整个集群中的jar,使用NFS文件夹作为$FLINK/lib可能有助于使所有TaskManager保持同步.或者,您可以简单地编写一个bash脚本来分发您的jar.

In order to manage jars in the whole cluster, it might be helpful to use a NFS folder as $FLINK/lib to keep all TaskManagers in sync. Or you simple write a bash script to distribute your jars.

这篇关于如何在Flink中引用外部Jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆