搭建本地執行Hadoop環境

shou丶掌印發表於2018-11-01

本地環境 win7-64,idea2016,hadoop2.6.5,jdk1.7

1. 新建maven專案,根目錄下新建input目錄,output目錄。Hadoop的jar包裡找Wordcount 案例程式碼。

   下載:https://download.csdn.net/download/qq_32443495/10758392

  pom.xml

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-core</artifactId>
      <version>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
      <version>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
  </dependencies>

    最終目錄結構

 

2. 新建一個Artifacts

3.Build 這個Artifacts

4.新建一個application  main-class  org.apache.hadoop.util.RunJar
 

 5.

program arguments 三行分別是:

1.你剛才build那個jar 的目錄和jar名

2.開始新建的輸入路徑

3.開始新建的輸出路徑

相關文章