运行hadoop中的实例wordcount及问题

来源:互联网 发布:python 迭代器的方法 编辑:程序博客网 时间:2024/06/06 00:10
1.准备数据
wc.txt wc2.txt
2.在hdfs中创建/wordcount/input文件夹
hdfs dfs -mkdir -p /wordcount/input
3.上传到hdfs文件系统中
hdfs dfs -put wc.txt wc2.txt /wordcount/input
4.进入apps/hadoop-2.6.4/share/hadoop/mapreduce目录
cd apps/hadoop-2.6.4/share/hadoop/mapreduce
5.运行实例wordcount
hadoop jar hadoop-mapreduce-examples-2.6.4.jar wordcount /wordcount/input /wordcount/output

注意:
运行wordcount实例代码时,显示
INFO ipc.Client: Retrying connect to server: node01/192.168.30.134:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)会重新连接服务器10次
原因:
没有启动yarn或者启动失败
解决:
启动yarn
start-yarn.sh