码迷,mamicode.com
首页 > 其他好文 > 详细

just a demo

时间:2021-01-26 12:23:58      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:out   ORC   mapreduce   xxx   common   ref   etc   dcl   include   

<!-- demodemo.xml -->
<
dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-core</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-hdfs</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>2.7.0</version> </dependency> <profiles> <profile> <id>id11111</id> <properties> <jar.name>xxxxx</jar.name> <main.class>mainxxxxx</main.class> <java.version>1.8</java.version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib</classpathPrefix> <!-- main函数 --> <mainClass>${main.class}</mainClass> </manifest> </archive> <includes> <include>com/rs/java/core/*.class</include> <include>**/*.properties</include> </includes> </configuration> </plugin> </plugins> </build> </profile> </profiles>

 

java  demo

Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();

Job job = Job.getInstance(conf, "jboname");
job.setJarByClass(AAA.class);
job.setOutputValueClass(Text.class);
job.setOutputKeyClass(Text.class);
job.setMapperClass(FirstMapper.class); //模式1,数据一天跑一次
job.setCombinerClass(FirstComb.class);
job.setReducerClass(FirstReducer.class);
job.setInputFormatClass(CombineSmallfileInputFormat.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
if(!job.waitForCompletion(true)) return ;

 

just a demo

标签:out   ORC   mapreduce   xxx   common   ref   etc   dcl   include   

原文地址:https://www.cnblogs.com/yanghaolie/p/14323121.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!