Hadoop Install (하둡 설치)

Many korean people still ask me how to download and install the hadoop. This post describes how to install, configure hadoop cluster. If you are familiar with English, See below links:

- Hadoop: Quick Start
- Hadoop: Cluster Setup

하둡 소개

Hadoop은 일반 PC급 컴퓨터들로 가상화된 대형 Storage를 형성하고 그 안에 보관된 거대한 데이터 셋을 병렬로 처리할 수 있도록 개발된 Java Software Framework 입니다. Map Reduce와 같이 단순화된 병렬 처리 모델은 복잡한 병렬 프로그램을 light-weight 하게 개발 할 수 있도록 도와 주고, Storage의 Fault tolerance 모델은 서비스/운영의 maintenance를 용이하게 합니다.

필요한것들

Hadoop Installation 이전 위에 언급된 바와같이 하둡은 Java Software Framework 이기때문에, JDK 1.6.x 이상이 필요합니다. (하둡 0.19.x 이상 기준) 그리고, Master와 Slaves 간의 통신을 위해 SSH 로 하기 때문에 SSH도 설치해야하며, 연결시 패스워드 입력 없이 자동으로 인식하기 위해서 공개키를 미리 복사해주는것이 좋습니다.


$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/udanax/.ssh/id_dsa):
Created directory '/home/udanax/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/udanax/.ssh/id_dsa.
Your public key has been saved in /home/udanax/.ssh/id_dsa.pub.
The key fingerprint is: blah~ blah~
$ _

$ cat ~/.ssh/id_dsa.pub | ssh id@host "cat >> .ssh/authorized_keys"
password: enter the password
$ _


설치/설정

하둡 다운로드는 여기에서 하세요. 압축만 적당한 디렉토리에 (각 서버 동일하게) 풀면됩니다. 그 다음 설정파일들로 Cluster를 구성합니다. 설정 파일들은 ${HADOOP_HOME}/conf 에 위치합니다.

$ cd ${HADOOP_HOME}
$ vi ./conf/hadoop-env.sh
# Java 홈 경로를 입력
export JAVA_HOME=/usr/local/java

$ vi ./conf/master
# 파일에 master 서버의 host 이름을 작성
MASTER_SERVER_NAME
ex) master.udanax.org

$ vi ./conf/slaves
# 파일에 slave들을 라인단위로 작성
SLAVE_SERVER_NAME_1
SLAVE_SERVER_NAME_2
ex) slave1.udanax.org

그리고, hadoop-site.xml 파일을 열어, 아래와 같이 기본적인 경로 및 URL을 설정해줍니다.

- hadoop.tmp.dir : 데이터 저장 디렉터리
- fs.default.name : HDFS 파일시스템 주소 (NameNode 가 올라간 master 서버)
- mapred.job.tracker : JobTracker 주소 (JobTracker 가 올라간 서버)

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->

<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/udanax/hadoop-storage</value>
<description>A base for other temporary directories.</description>
</property>

<property>
<name>fs.default.name</name>
<value>hdfs://master.udanax.org:9000/</value>
<description>
The name of the default file system. Either the literal string
"local" or a host:port for NDFS.
</description>
</property>

<property>
<name>mapred.job.tracker</name>
<value>master.udanax.org:9001</value>
<description>
The host and port that the MapReduce job tracker runs at. If
"local", then jobs are run in-process as a single map and
reduce task.
</description>
</property>

<property>
<name>mapred.map.tasks</name>
<value>3</value>
<description>
define mapred.map tasks to be number of slave hosts
</description>
</property>

<property>
<name>mapred.reduce.tasks</name>
<value>3</value>
<description>
define mapred.reduce tasks to be number of slave hosts
</description>
</property>

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

실행


$ cd ${HADOOP_HOME}
$ ./bin/hadoop namenode -format
$ ./bin/start-all.sh

$ ./bin/hadoop jar hadoop-example.jar pi 10 10

2 comments:

  1. 윤진석님 안녕하세요? 저는 이번에 검색엔진 개발을 하고 있는 문성학(학생)입니다. 현재 5명이 로봇을 만들고 루씬을 분석하고 있습니다. 그러나 검색엔진에서는 지금까지 배웠던 DB(RDBMS)와 다른 것을 쓴다고 너치홈페이지와 구글에 관한 책을 읽으면서 알게되었습니다. 저희 프로젝트 기간이 8주인데요. 벌서 3주차에 접어 들었는데 이것에 대한 감을 못잡고 있어서 감히 이곳에 글을 올립니다. 이 기간내에 하둡을 익혀서 저희 시스템에 적용하는 것이 가능할 지, 가능하다면 어떻게 공부하는 것이 빠른 것인지... 또 만약 불가능하거나 비추인 경우 다른 것 추천 부탁드립니다. ironwill1205@nate.com 입니다. 감사합니다.

    ReplyDelete
  2. 네, 안녕하세요.

    5주 기간이라면 충분히 lucene, nutch 분석해서 응용해볼수있는 시간이 될것 같습니다. DBMS로 하는것보다는 lucene사용하는걸 추천합니다.

    ReplyDelete