zoukankan      html  css  js  c++  java
  • 命令行下编译Wordcount

    1. 编辑WordCount.java文件,在下载的hadoop安装包里有WordCount的例子

    http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0.tar.gz

    2. 把WordCount编译成一个jar文件

     mkdir wordcount_classes
     javac -cp classpath -d wordcount_classes WordCount.java
     jar -cvf wordcount.jar -C wordcount_classes/ . 
    这里的classpath和之前的hadoop版本有所区别,需要按照新的设置方法,这一点网上很少提及!
    新的classpath为:
    $HADOOP_HOME/share/hadoop/common/hadoop-common-2.2.0.jar:$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.2.0.jar:$HADOOP_HOME/share/hadoop/common/lib/commons-cli-1.2.jar
     

    3.创建HDFS文件夹

    hadoop fs -mkdir wordCount
    hadoop fs -mkdir wordCount/input
    echo "Hello World Bye World" > file0
    echo "Hello Hadoop Goodbye Hadoop" > file1
    hadoop fs -put file* wordCount/input

    4.运行

    hadoop jar wordcount.jar org.myorg.WordCount wordCount/input wordCount/output
    hadoop fs -cat /user/cloudera/wordcount/output/part-00000
    
  • 相关阅读:
    winform右键菜单
    IIS添加映射配置
    linux+nginx+python+django环境配置
    ASP.NET获取客户端IP地址
    Ext未定义问题解决
    c#获取硬件信息
    DevExpress GridControl使用方法总结
    CDN技术原理
    Mac搭建nginx+rtmp服务器
    MAXOS安装FFMPEG
  • 原文地址:https://www.cnblogs.com/kxdblog/p/4115230.html
Copyright © 2011-2022 走看看