상당히 많은 인터넷글을 보면서 따라해보고 여러가지 다른방법시도 해보았지만 


apache 에서 제공하는 이 뉴얼이 가장 정확하였고 오류또한 없었다. 


nutch 구성 예정인 사용자라면


아파치에서 권장하는 nutch 와 hadoop 버전에 맞추어 설정하여야한다. 


nutch 2.3.1 ver = (Apache Hadoop 1.2.1 및 2.5.2) 



(*실제 nutch 구동떄문에 하둡의 무수히 많은 버전을 설치하는 삽질을하였다..)


Hadoop 2.5.2 / nutch 2.3.1 



https://archive.apache.org/dist/hadoop/core/hadoop-2.5.2/


Hadoop MapReduce Next Generation - Setting up a Single Node Cluster.

Purpose

This document describes how to set up and configure a single-node Hadoop installation so that you can quickly perform simple operations using Hadoop MapReduce and the Hadoop Distributed File System (HDFS).

Prerequisites

Supported Platforms

  • GNU/Linux is supported as a development and production platform. Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.
  • Windows is also a supported platform but the followings steps are for Linux only. To set up Hadoop on Windows, see wiki page.

Required Software

Required software for Linux include:

  1. Java™ must be installed. Recommended Java versions are described at HadoopJavaVersions.
  2. ssh must be installed and sshd must be running to use the Hadoop scripts that manage remote Hadoop daemons.

Installing Software

If your cluster doesn't have the requisite software you will need to install it.

For example on Ubuntu Linux:

  $ sudo apt-get install ssh
  $ sudo apt-get install rsync

Download

To get a Hadoop distribution, download a recent stable release from one of the Apache Download Mirrors.

Prepare to Start the Hadoop Cluster

Unpack the downloaded Hadoop distribution. In the distribution, edit the file etc/hadoop/hadoop-env.sh to define some parameters as follows:

  # set to the root of your Java installation
  export JAVA_HOME=/usr/java/latest

  # Assuming your installation directory is /usr/local/hadoop
  export HADOOP_PREFIX=/usr/local/hadoop

Try the following command:

  $ bin/hadoop

This will display the usage documentation for the hadoop script.

Now you are ready to start your Hadoop cluster in one of the three supported modes:

Standalone Operation

By default, Hadoop is configured to run in a non-distributed mode, as a single Java process. This is useful for debugging.

The following example copies the unpacked conf directory to use as input and then finds and displays every match of the given regular expression. Output is written to the given output directory.

  $ mkdir input
  $ cp etc/hadoop/*.xml input
  $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.2.jar grep input output 'dfs[a-z.]+'
  $ cat output/*

Pseudo-Distributed Operation

Hadoop can also be run on a single-node in a pseudo-distributed mode where each Hadoop daemon runs in a separate Java process.

Configuration

Use the following:

etc/hadoop/core-site.xml:

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

etc/hadoop/hdfs-site.xml:

<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

Setup passphraseless ssh

Now check that you can ssh to the localhost without a passphrase:

  $ ssh localhost

If you cannot ssh to localhost without a passphrase, execute the following commands:

  $ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
  $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

Execution

The following instructions are to run a MapReduce job locally. If you want to execute a job on YARN, see YARN on Single Node.

  1. Format the filesystem:
      $ bin/hdfs namenode -format
  2. Start NameNode daemon and DataNode daemon:
      $ sbin/start-dfs.sh

    The hadoop daemon log output is written to the $HADOOP_LOG_DIR directory (defaults to $HADOOP_HOME/logs).

  3. Browse the web interface for the NameNode; by default it is available at:
    • NameNode - http://localhost:50070/
  4. Make the HDFS directories required to execute MapReduce jobs:
      $ bin/hdfs dfs -mkdir /user
      $ bin/hdfs dfs -mkdir /user/<username>
  5. Copy the input files into the distributed filesystem:
      $ bin/hdfs dfs -put etc/hadoop input
  6. Run some of the examples provided:
      $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.2.jar grep input output 'dfs[a-z.]+'
  7. Examine the output files:

    Copy the output files from the distributed filesystem to the local filesystem and examine them:

      $ bin/hdfs dfs -get output output
      $ cat output/*

    or

    View the output files on the distributed filesystem:

      $ bin/hdfs dfs -cat output/*
  8. When you're done, stop the daemons with:
      $ sbin/stop-dfs.sh

YARN on Single Node

You can run a MapReduce job on YARN in a pseudo-distributed mode by setting a few parameters and running ResourceManager daemon and NodeManager daemon in addition.

The following instructions assume that 1. ~ 4. steps of the above instructions are already executed.

  1. Configure parameters as follows:

    etc/hadoop/mapred-site.xml:

    <configuration>
        <property>
            <name>mapreduce.framework.name</name>
            <value>yarn</value>
        </property>
    </configuration>

    etc/hadoop/yarn-site.xml:

    <configuration>
        <property>
            <name>yarn.nodemanager.aux-services</name>
            <value>mapreduce_shuffle</value>
        </property>
    </configuration>
  2. Start ResourceManager daemon and NodeManager daemon:
      $ sbin/start-yarn.sh
  3. Browse the web interface for the ResourceManager; by default it is available at:
    • ResourceManager - http://localhost:8088/
  4. Run a MapReduce job.
  5. When you're done, stop the daemons with:
      $ sbin/stop-yarn.sh

Fully-Distributed Operation

For information on setting up fully-distributed, non-trivial clusters see Cluster Setup.







번역본


Hadoop MapReduce 차세대 - 단일 노드 클러스터 설정.

목적

이 문서는 단일 노드 Hadoop 설치를 설정하고 구성하여 Hadoop MapReduce 및 Hadoop Distributed File System (HDFS)을 사용하여 간단한 작업을 신속하게 수행하는 방법을 설명합니다.

선결 요건

지원 플랫폼

  • GNU / Linux는 개발 및 생산 플랫폼으로 지원됩니다. Hadoop은 2000 노드를 가진 GNU / Linux 클러스터에서 시연되었습니다.
  • Windows도 지원되는 플랫폼이지만 다음 단계는 Linux에만 해당됩니다. Windows에서 Hadoop을 설정하려면 wiki 페이지를 참조 하십시오 .

필수 소프트웨어

Linux에 필요한 소프트웨어는 다음과 같습니다.

  1. Java ™가 설치되어 있어야합니다. 권장 Java 버전은 HadoopJavaVersions에 설명되어 있습니다 .
  2. ssh가 설치되어 있어야하며 원격 Hadoop 데몬을 관리하는 Hadoop 스크립트를 사용하려면 sshd가 실행 중이어야합니다.

소프트웨어 설치

클러스터에 필수 소프트웨어가 없다면 설치해야합니다.

예를 들어 Ubuntu Linux의 경우 :

  $ sudo apt-get install ssh 
  $ sudo apt-get install rsync

다운로드

Hadoop 배포본을 얻으려면 아파치 다운로드 미러 (Apache Download Mirrors) 중 하나에서 최신 안정 버전을 다운로드하십시오 .

Hadoop 클러스터 시작 준비

다운로드 한 Hadoop 배포의 압축을 풉니 다. 배포판에서, etc / hadoop / hadoop-env.sh 파일을 편집하여 다음과 같은 매개 변수를 정의하십시오.

  # Java 설치 
  내보내기 의 루트로 설정합니다. JAVA_HOME = / usr / java / latest 

  # 설치 디렉토리가 / usr / local / hadoop이라고 가정합니다. 
  export HADOOP_PREFIX = / usr / local / hadoop

다음 명령을 시도하십시오.

  $ bin / hadoop

그러면 hadoop 스크립트에 대한 사용 설명서가 표시됩니다.

이제 3 가지 지원 모드 중 하나에서 Hadoop 클러스터를 시작할 준비가되었습니다.

독립 실행 형 작업

기본적으로 Hadoop은 비 분산 모드에서 단일 Java 프로세스로 실행되도록 구성됩니다. 이것은 디버깅에 유용합니다.

다음 예제는 압축 해제 된 conf 디렉토리를 복사하여 입력으로 사용하고 주어진 정규 표현식의 모든 일치를 찾아서 표시합니다. 출력은 주어진 출력 디렉토리에 기록됩니다.

  $ mkdir 입력 
  $ cp etc / hadoop / *. xml 입력 
  $ bin / hadoop jar 공유 / hadoop / mapreduce / hadoop-mapreduce-examples-2.5.2.jar grep 입력 출력 'dfs [az.] +' 
  $ cat 출력 / *

의사 분산 작업

또한 Hadoop은 각 Hadoop 데몬이 별도의 Java 프로세스에서 실행되는 의사 배포 모드의 단일 노드에서 실행할 수 있습니다.

구성

다음을 사용하십시오.

etc / hadoop / core-site.xml :

<configuration> 
    <property> 
        <name> fs.defaultFS </ name> 
        <value> hdfs : // localhost : 9000 </ value> 
    </ property> 
</ configuration>

etc / hadoop / hdfs-site.xml :

<configuration> 
    <property> 
        <name> dfs.replication </ name> 
        <value> 1 </ value> 
    </ property> 
</ configuration>

설치 passphraseless ssh

이제 passphrase없이 localhost로 ssh 할 수 있는지 확인하십시오 :

  $ ssh localhost

passphrase없이 localhost로 ssh 할 수 없다면 다음 명령을 실행하십시오 :

  $ ssh-keygen -t dsa -P "-f ~ / .ssh / id_dsa 
  $ cat ~ / .ssh / id_dsa.pub >> ~ / .ssh / authorized_keys

실행

다음 지시 사항은 MapReduce 작업을 로컬에서 실행하는 것입니다. YARN에서 작업을 실행하려면 단일 노드의 YARN을 참조하십시오 .

  1. 파일 시스템을 포맷하십시오 :
      $ bin / hdfs namenode -format
  2. NameNode 데몬 및 DataNode 데몬 시작 :
      $ sbin / start-dfs.sh

    hadoop 데몬 로그 출력은 HADOOP_LOG_DIR 디렉토리에 기록됩니다 (기본값은 HADOOP_HOME / logs입니다 ).

  3. NameNode에 대한 웹 인터페이스를 탐색하십시오. 기본적으로 다음 위치에서 사용할 수 있습니다.
    • NameNode - http : // localhost : 50070 /
  4. MapReduce 작업을 실행하는 데 필요한 HDFS 디렉토리를 만듭니다.
      $ bin / hdfs dfs -mkdir / 사용자 
      $ bin / hdfs dfs -mkdir / user / <username>
  5. 입력 파일을 분산 파일 시스템에 복사하십시오.
      $ bin / hdfs dfs -put etc / hadoop 입력
  6. 제공되는 몇 가지 예제를 실행하십시오.
      $ bin / hadoop jar share / hadoop / mapreduce / hadoop-mapreduce-examples-2.5.2.jar grep 입력 출력 'dfs [az.] +'
  7. 출력 파일을 검사하십시오.

    출력 파일을 분산 파일 시스템에서 로컬 파일 시스템으로 복사하고 검사하십시오 :

      $ bin / hdfs dfs -get 출력 출력 
      $ cat 출력 / *

    또는

    분산 파일 시스템의 출력 파일보기 :

      $ bin / hdfs dfs -cat 출력 / *
  8. 완료되면 데몬을 중지하십시오.
      $ sbin / stop-dfs.sh

단일 노드의 YARN

몇 개의 매개 변수를 설정하고 ResourceManager 데몬과 NodeManager 데몬을 추가로 실행하여 의사 배포 모드에서 YARN의 MapReduce 작업을 실행할 수 있습니다.

다음 명령어 는 위의 명령어 의 1 ~ 4. 단계 가 이미 실행 되었다고 가정합니다 .

  1. 다음과 같이 매개 변수를 구성하십시오.

    etc / hadoop / mapred-site.xml :

    <configuration> 
        <property> 
            <name> mapreduce.framework.name </ name> 
            <value> 원사 </ value> 
        </ property> 
    </ configuration>

    etc / hadoop / yarn-site.xml :

    <configuration> 
        <property> 
            <name> yarn.nodemanager.aux-services </ name> 
            <value> mapreduce_shuffle </ value> 
        </ property> 
    </ configuration>
  2. ResourceManager 데몬 및 NodeManager 데몬 시작 :
      $ sbin / start-yarn.sh
  3. ResourceManager의 웹 인터페이스를 탐색하십시오. 기본적으로 다음 위치에서 사용할 수 있습니다.
    • ResourceManager - http : // localhost : 8088 /
  4. MapReduce 작업을 실행하십시오.
  5. 완료되면 데몬을 중지하십시오.
      $ sbin / stop-yarn.sh

완전히 분산 된 작업

완전 분산 형 클러스터 설정에 대한 정보는 클러스터 설정을 참조하십시오 .



https://hadoop.apache.org/docs/r2.5.2/hadoop-project-dist/hadoop-common/SingleCluster.html


+ Recent posts