Hadoop2.0 YARN cloudra4.4.0 WordCount实例
程序员文章站
2022-04-16 16:48:31
...
其他都没啥 这个 jar都在这里了。 import java.io.IOException;import java.util.StringTokenizer;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.IntWritable;import org.apache.hadoop.io.Te
其他都没啥 这个 jar都在这里了。
import java.io.IOException; import java.util.StringTokenizer; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; public class WordCount { public static class TokenizerMapper extends Mapper
导出为Jar包,上传(发现这个版本居然不知道怎么在Eclipse里直接跑,只好上传了)
./hadoop jar ../etc/hadoop/WordCount.jar /user/hadoop/input /user/hadoop/output
input里是yard02的etc/profile文件
结果:
!= 1 "$BASH" 2 "$PS1" 1 "/bin/sh" 1 "`id 1 # 6 $i 2 && 1 ' 3 (bash(1), 1 (sh(1)) 1 -d 1 -eq 1 -f 1 -r 1 -u`" 1 . 2 ...). 1 .profile 1 /etc/bash.bashrc 2 /etc/login.defs. 1 /etc/profile.d 1 /etc/profile.d/*.sh; 1 /etc/profile: 1 0 1 Bourne 2 CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH 1 JAVA_HOME=/usr/local/jdk1.7.0_21 1 JRE_HOME=/usr/local/jdk1.7.0_21/jre 1 PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH 1 PS1. 1 PS1='# 1 PS1='$ 1 PS1='\h:\w\$ 1 See 1 The 2 [ 7 ] 1 ]; 6 already 1 and 2 ash(1), 1 bash.bashrc 1 by 1 compatible 1 default 2 do 1 done 1 else 2 export 4 fi 6 file 2 for 2 handled 1 i 2 if 6 in 1 is 1 ksh(1), 1 now 1 pam_umask(8) 1 pam_umask. 1 sets 1 shell 1 shells 1 system-wide 1 the 2 then 6 umask 1 unset 1