欢迎投稿

今日深度:

hadoop引用外部jar包,hadoop引用jar包

hadoop引用外部jar包,hadoop引用jar包


    hadoop引用外部jar包有两种方式:

第一:实用-libjars  

第二:在程序中通过tmpjars参数设定

job.getConfiguration().set("tmpjars",jars);

jars为所有外部jar包字符串形式,英文逗号分隔。

在运行hadoop命令时,可通过参数的方式,把所需要的外部jar包(绝对路径)引入,然后再mapreduce程序中对该参数进行处理,并通过

job.getConfiguration().set("tmpjars",jars);

进行设置。

 

外部jar包的话,可以放在本地也可以放在hdfs中。

本地通过以下方式获取FileSystem :FileSystem fs= FileSystem.getLocal(Configuration);

HDFS则为:FileSystem fs = path.getFileSystem(Configuration);

然后再获取路径,finalPath = new Path(jar绝对路径).makeQualified(fs).toString();


www.htsjk.Com true http://www.htsjk.com/Hadoop/29695.html NewsArticle hadoop引用外部jar包,hadoop引用jar包     hadoop引用外部jar包有两种方式: 第一:实用-libjars   第二:在程序中通过tmpjars参数设定 job.getConfiguration().set("tmpjars",jars); jars为所有外部jar包字符...
相关文章
    暂无相关文章
评论暂时关闭