필자 기준으로 리눅스 배포판에 상관 없이 copy&paste로만 설치가 가능 하도록 문서를 작성했습니다. (까먹지 않기 위함)
(JDK, hadoop의 설치 경로는 /usr/local)
– JDK 설치
아래 주소에서 다운로드 받습니다.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
root@yongbok:~# cd /usr/local/src
root@yongbok:/usr/local/src# tar xzvf jdk-7u25-linux-x64.tar.gz
root@yongbok:/usr/local/src# mv jdk1.7.0_25 /usr/local
– hadoop 설치
root@yongbok:/usr/local/src# wget http://mirror.yongbok.net/apache/hadoop/common/hadoop-1.2.0/hadoop-1.2.0.tar.gz
root@yongbok:/usr/local/src# tar xzvf hadoop-1.2.0.tar.gz
root@yongbok:/usr/local/src# mv hadoop-1.2.0 /usr/local
– JDK, hadoop PATH 설정
root@yongbok:~# echo ‘export JAVA_HOME=/usr/local/jdk1.7.0_25’ >> ~/.profile
root@yongbok:~# echo ‘export HADOOP_INSTALL=/usr/local/hadoop-1.2.0’ >> ~/.profile
root@yongbok:~# echo ‘export PATH=$PATH:$HADOOP_INSTALL/bin’ >> ~/.profile
– SSH key 생성
root@yongbok:~# ssh-keygen -t rsa
root@yongbok:~# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
root@yongbok:~# ssh localhost
만약 sshd 포트가 22번이 아닌 경우 아래와 같이 포트를 변경 해주면 됨.
root@yongbok:~# nano /etc/ssh/ssh_config
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
Port 2222
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
– hadoop conf 설정
– hadoop-env.sh
root@yongbok:~# nano $HADOOP_INSTALL/conf/hadoop-env.sh
export JAVA_HOME=/usr/local/jdk1.7.0_25
export HADOOP_HOME=/usr/local/hadoop-1.2.0
# localhost: Warning: $HADOOP_HOME is deprecated. 경고 메세지 나올경우
export HADOOP_HOME_WARN_SUPPRESS=”TRUE”
– core-site.xml
root@yongbok:~# nano $HADOOP_INSTALL/conf/core-site.xml
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?><!– Put site-specific property overrides in this file. –>
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop-1.2.0/hadoop-${user.name}</value>
</property>
</configuration>
– hdfs-site.xml
root@yongbok:~# nano $HADOOP_INSTALL/conf/hdfs-site.xml
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?><!– Put site-specific property overrides in this file. –>
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/usr/local/hadoop-1.2.0/dfs/name</value>
</property>
<property>
<name>dfs.name.edits.dir</name>
<value>${dfs.name.dir}</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/usr/local/hadoop-1.2.0/dfs/data</value>
</property>
</configuration>
– mapred-site.xml
root@yongbok:~# nano $HADOOP_INSTALL/conf/mapred-site.xml
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?><!– Put site-specific property overrides in this file. –>
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
<property>
<name>mapred.local.dir</name>
<value>${hadoop.tmp.dir}/mapred/local</value>
</property>
<property>
<name>mapred.system.dir</name>
<value>${hadoop.tmp.dir}/mapred/system</value>
</property>
</configuration>
– namenode format
서비스 시작 하기 전에 네임노드 포멧 해야함
root@yongbok:~# hadoop namenode -format
13/06/27 13:14:34 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = mirror.yongbok.net/172.27.92.51
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 1.2.0
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1479473; compiled by ‘hortonfo’ on Mon May 6 06:59:37 UTC 2013
STARTUP_MSG: java = 1.7.0_25
************************************************************/
13/06/27 13:14:34 INFO util.GSet: Computing capacity for map BlocksMap
13/06/27 13:14:34 INFO util.GSet: VM type = 64-bit
13/06/27 13:14:34 INFO util.GSet: 2.0% max memory = 932118528
13/06/27 13:14:34 INFO util.GSet: capacity = 2^21 = 2097152 entries
13/06/27 13:14:34 INFO util.GSet: recommended=2097152, actual=2097152
13/06/27 13:14:35 INFO namenode.FSNamesystem: fsOwner=root
13/06/27 13:14:35 INFO namenode.FSNamesystem: supergroup=supergroup
13/06/27 13:14:35 INFO namenode.FSNamesystem: isPermissionEnabled=true
13/06/27 13:14:35 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
13/06/27 13:14:35 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
13/06/27 13:14:35 INFO namenode.FSEditLog: dfs.namenode.edits.toleration.length = 0
13/06/27 13:14:35 INFO namenode.NameNode: Caching file names occuring more than 10 times
13/06/27 13:14:35 INFO common.Storage: Image file of size 110 saved in 0 seconds.
13/06/27 13:14:35 INFO namenode.FSEditLog: closing edit log: position=4, editlog=/usr/local/hadoop-1.2.0/dfs/name/current/edits
13/06/27 13:14:35 INFO namenode.FSEditLog: close success: truncate to 4, editlog=/usr/local/hadoop-1.2.0/dfs/name/current/edits
13/06/27 13:14:35 INFO common.Storage: Storage directory /usr/local/hadoop-1.2.0/dfs/name has been successfully formatted.
13/06/27 13:14:35 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at mirror.yongbok.net/172.27.92.51
************************************************************/
– 서비스 시작
root@yongbok:~# start-all.sh
namenode running as process 14273. Stop it first.
root@localhost’s password:
localhost: datanode running as process 14479. Stop it first.
root@localhost’s password:
localhost: secondarynamenode running as process 14660. Stop it first.
jobtracker running as process 14773. Stop it first.
root@localhost’s password:
localhost: tasktracker running as process 14959. Stop it first.
그 다음은 알아서 웹페이지로 확인
Hadoop Map/Reduce Administration (jobtracker)
http://localhost:50030/
NameNode (dfshealth)
http://localhost:50070/