本篇内容主要讲解“getConf与new Configuration怎么配置”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“getConf与new Configuration怎么配置”吧!
#getConf
所有的配置都通过命令的形式,此种情况下支持-files
sudo -uwirelessdev hadoop jar \ /home/q/script/mods/mrjob/mods-1.0-SNAPSHOT-jar-with-dependencies.jar \ -files /home/q/script/mods/mrjob/mods.acid \ -D mapreduce.job.queuename=wirelessdev \ -D mapreduce.job.priority=VERY_HIGH \ -D mapreduce.map.memory.mb=8192 \ -D mapreduce.map.java.opts='-Xmx8192M' \ -D mapreduce.reduce.memory.mb=8192 \ -D mapreduce.reduce.java.opts='-Xmx8192M' \ -D mapreduce.job.reduces=100 \ -D mapred.reduce.tasks=100 \ -D mapreduce.job.name=mods_firstjob_leofei.li \ /user/wirelessdev/marmot_warehouse/ods/ods_modss_frame/dt=2016-07-13/platform=Ios-pad/* \ /user/wirelessdev/leofei.li/firstjob
#new Configuration 配置项通过代码进行配置,此时,通过命令行的配置项会失效
Configuration conf =new Configuration(); conf.set("fs.defaultFS","hdfs://qunarcluster"); conf.set("mapreduce.job.queuename","wirelessdev"); conf.set("mapreduce.job.reduces","100"); conf.set("mapreduce.job.priority","VERY_HIGH"); conf.set("mapreduce.map.memory.mb","8192"); conf.set("mapreduce.map.java.opts","-Xmx8192M"); conf.set("mapreduce.reduce.memory.mb","8192"); conf.set("mapreduce.reduce.java.opts","-Xmx8192M");
该情况下不支持-files,需要使用DistributedCache,默认hdfs路径
DistributedCache.addCacheFile(new Path("/user/wirelessdev/leofei.li/conf/mods.acid").toUri(), conf);
#推荐
Configuration conf = getConf(); conf.set("mapreduce.job.queuename","wirelessdev"); Job job = Job.getInstance(conf,"mods_firstjob_leofei.li");
到此,相信大家对“getConf与new Configuration怎么配置”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。