输入
Steven Lucy
Steven Jack
Jone Lucy
Jone Jack
Lucy Mary
Lucy Frank
Jack Alice
Jack Jesse
David Alice
David Jesse
Philip David
Philip Alma
Mark David
Mark Alma
创建文件夹:mkdir /home/stu/codes
进入:cd /home/stu/codes
编辑文档:vim a.txt
查看:ls
开启hadoop:
进入:cd /usr/local/hadoop
启动:./sbin/start-dfs.sh
hdfs创建:./bin/hdfs dfs -mkdir -p /user/stu
上传至hdfs:./bin/hdfs dfs -put /home/stu/codes/a.txt /user/stu/indir3
编辑Join2.java
进入:cd /usr/local/hadoop
编辑文档:vim Join2.java
export:让javac编译程序可以找到Hadoop相关的JAR包:
export CLASSPATH="/usr/local/hadoop/share/hadoop/common/hadoop-common-3.1.3.jar:/usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-core-3.1.3.jar:/usr/local/hadoop/share/hadoop/common/lib/commons-cli-1.2.jar:$CLASSPATH"
进入:cd /home/stu/codes
????????????
编译:javac Join2.java
打包:jar -cvf join2.jar *.class
生成结果:./bin/hadoop jar join2.jar Join2 indir3 outdir3
查看结果:hdfs dfs -cat outdir3/*