You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by Yan Tang <ya...@cisco.com.INVALID> on 2021/01/22 07:38:35 UTC

请教关于Flink yarnship的使用

我把配置和jar包分开了,用-yt option将配置文件Ship到yarn cluster中,但是在获取配置文件的时候,老是拿不到,有人有相关经验么?
我的提交命令:
-yt /path/to/conf    

code:
this.getClass().getResourceAsStream("conf/cmp_online.cfg")
但一直返回null.







--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复:请教关于Flink yarnship的使用

Posted by Yan Tang <ya...@cisco.com.INVALID>.
我试过了,还是null



--
Sent from: http://apache-flink.147419.n8.nabble.com/

回复:请教关于Flink yarnship的使用

Posted by 叶贤勋 <yx...@163.com>.
URL url = this.getClass().getClassLoader().getResource("conf”);

String dir = url.getFile();
dir目录下应该会包含ship的配置文件,你可以试下。
在2021年01月22日 15:38,Yan Tang<ya...@cisco.com.INVALID> 写道:
我把配置和jar包分开了,用-yt option将配置文件Ship到yarn cluster中,但是在获取配置文件的时候,老是拿不到,有人有相关经验么?
我的提交命令:
-yt /path/to/conf    

code:
this.getClass().getResourceAsStream("conf/cmp_online.cfg")
但一直返回null.







--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 请教关于Flink yarnship的使用

Posted by Yan Tang <ya...@cisco.com.INVALID>.
如果-yt 不适用我这种场景,真不知道这个option是做什么的了。在spark中我用的就是--files,可以达到我想要的效果。



--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 请教关于Flink yarnship的使用

Posted by yang nick <bd...@gmail.com>.
这个方法应该是读取本地的文件,但是你放到yarn中执行,就会找不到这个文件。所以建议可以把配置上传到hdfs中试试看

Yan Tang <ya...@cisco.com.invalid> 于2021年1月22日周五 下午4:53写道:

> 我把配置和jar包分开了,用-yt option将配置文件Ship到yarn
> cluster中,但是在获取配置文件的时候,老是拿不到,有人有相关经验么?
> 我的提交命令:
> -yt /path/to/conf
>
> code:
> this.getClass().getResourceAsStream("conf/cmp_online.cfg")
> 但一直返回null.
>
>
>
>
>
>
>
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>

Re: 请教关于Flink yarnship的使用

Posted by silence <sl...@aliyun.com.INVALID>.
 你可以尝试同时指定-C "file:///path/to/conf/cmp_online.cfg" 以及 -yt /path/to/conf 来进行测试
然后代码里这么获取this.getClass().getResourceAsStream("cmp_online.cfg")



--
Sent from: http://apache-flink.147419.n8.nabble.com/