everydayminder

learn something everyday

Archive for July 2008

The Hadoop Distributed File System : Architecture and Design 요약

leave a comment »

본 내용은 해당 링크내의 원본을 읽고, 키워드 등의 관점에서 축약하였음

원본 링크 :
http://hadoop.apache.org/core/docs/current/hdfs_design.html

원본 링크내 첨부파일 :jk1.pdf
본 내용은 해당 링크내의 원본을 읽고, 키워드 등의 관점에서 축약하였음

■ Introduction
    – HDFS is highly fault-tolerant and is designed to be deployed on low-cost hardware.
    – HDFS provided high throughtput access to application data and is suitable for applications that have large data sets.

■ Assumptions and Goals
   – Hadrware Failure : detection of faults and quick, automatic recovery
   – Streaming Data Access : It is designed more for batch processing rather than interactive use by users
   – Large Data Sets : It provides high aggregate data bandwidth and scale to hundreds of nodes in a single cluster.
   – Simple Coherency Model : write-once-read-many access model for files
   – “Moving Computation is Cheaper than Moving Data” : It is often better to migrate the computation closer to where the data is located rather than moving the data to where the application is running. HDFS provides interfaces for applications to move themselves closer to where the data is located.
   – Portability Across Heterogeneous Hardware and Software Platforms : HDFS is easily portable from one platform to another.

Written by everydayminder

July 29, 2008 at 06:37

Posted in Hadoop

HBase에서 HQL 사용하기

leave a comment »

HBase에서 HQL 사용하기
   (wiki.apache.org내용을 근거로)

설치된 HBase를 바탕으로, HQL을 수행하였다. (bin/hbase shell)

해당 정보의 참고 링크는 아래와 같다.
http://wiki.apache.org/hadoop/Hbase/HbaseShell?action=print

1. Create Table
    hql> create table movielog_table (
       –> year, length, inColor, studioName, vote, producer, actor);

2. Insert Data
   hql> insert into movielog_table (year:, length:, inColor:, studioName:,
        ‘vote:user name’, producer:, ‘actor:hero’)
      –> valules (‘1977’, ‘124’, ‘true’, ‘Fox’, ‘5’, ‘George Lucas’, ‘Mark Hamill’)
      –> where row = ‘Star Wars’;

  * 내가 해 본 시도)
    – column 명을 주지 않고, 곧바로 values들만 넣어봄 : 에러
    – where 부분에서 row key 를 지정하지 않음 : 당연히 에러!
   
  *  row key가 따로 명시되지만, 사실 일반 PK 필드와 동일함.
  *  사용시 where 이후에 기록을 꼭해줘야 함. (활용폭이 적음, 맵 구조인지라
      키를 중심으로 데이터를 처리함)
  *  관계형 DB에 비해 where 조건에 넣을 수 있는 실질적인 비교구문이 없음

3. Select Data
   hql> select count(studioName:FOX) from movielog_table;

4. Truncate
   hql> truncate table 테이블명

5. Drop Table
   hql> drop table 테이블명

* truncate나 drop table을 실행하기 전에 반드시 disable 테이블명을 해줘야 실행된다.

Written by everydayminder

July 25, 2008 at 09:00

Posted in Hadoop

HBase 설치/설정하기

leave a comment »

Michael 씨가 자세하게 설명했던 HDFS 설정과는 달리,
HBase 설정은 wiki.apache.org/hadoop/HBase에 나와있는 설명이 전부이다.
물론, 웹에서 많은 사람들의 노력의 흔적은 곳곳에 있긴 하지만, 역시 어렵다.
기본적인 수준의 설명이나, 링크의 소개, 해봤더니 잘 되더라는 소감이 대다수이니까.

1.  내 시스템 구성
   1) 앞서 설정한 HDFS(master, slave)  -> 2대
   2) HBase -> 1대

2. 미리 준비할 것
   1) hbase1과 master, slave 간 ssh가 미리 설정되어 있어야 함.
      (비밀번호 없이 SSH 인증하기 참조)
   2) hbase1, master, slave는 서로 reachable 해야 함.
     (hbase1는 master랑만 통신해도 될 줄 알았는데.. 아니었음) 

3. 환경 설정
   1) .bashrc에 HBASE_HOME을 설정
   2) /conf/hbase-env.sh에 JAVA_HOME 설정
   3) /conf/hbase-defaul.xml을 /conf/hbase-site.xml로 복사
   4) /conf/hbase-site.xml중, hbase,master 항목과 hbase.rootdir 항목 변경
      – hbase.master -> example.org:60000을 hbase1:60000 으로 설정  
      – hbase.rootdir -> hdfs://example.org:9000/hbase를  master:54310/hbase로
        설정
        (hbase가 뜨는 곳은 hbase1이고, hbase가 사용할 hdfs는 master로 시작됨)
   5) /conf/regionservers는 ${HADOOP_HOME}/conf/slaves와 동일하게 작성함
   6) Hbase가 HDFS를 제대로 쓰도록 하기 위해, hadoop-site.xml이 필요하므로,
      ${HBASE_HOME}/conf에 ${HADOOP_HOME}/conf/hadoop-site.xml을
      복사함.

4. 실행
   1) 띄우기 : ${HBASE_HOME}/bin/start-hbase.sh
      – 성공적으로 뜨면, 로그에 에러가 안 남음
      – jps 결과 : HMaster, HRegionServer가 추가됨
   2) 종료하기 : ${HBASE_HOME}/bin/stop-hbase.sh
      – jps 실행시, HMaster, HRegionServer가 사라짐

* 문제점
   – 내가 실험한 결과, start-hbase.sh 가 정상 작동하지 않는다. HMaster는
     뜨지만,  HRegionServer가 정상적으로 뜨지 않아서 쓸 수 없는 상태가 됨.
   – path가 너무 길거나 복잡하면 에러가 생기는 듯 한데, shell을 고쳐서 직접
     실행시키면 뜨기는 한다. 당분간은 이렇게라도 실행시켜봐야할 듯.
   – 정상적으로 동작하면, jps에도 뜨지만, start-base/stop-base 수행시간도 짧다.
     오작동시, 시간이 길어지며 최악의 경우, kill도 감수해야 한다. (vulnerablity)

Written by everydayminder

July 25, 2008 at 00:31

Posted in Hadoop

HDFS 설정하기

leave a comment »

기본적으로는,

아래 posting과 같이 Michael G. Noll씨가 설명한 바와 같이 따라하면,

하나의 machine에 single cluster를 이상없이 설치할 수 있다.

Michael이 권고하기를,
여러 개로 multi cluster를 구축하기에 앞서, 단일 cluster로 정상 작동하는지
확인 후, 여러 개를 붙여가는 방법이 보다 효과적이라고 한다.

두 개의 cluster를 master-slave로 구성하고자 한다면,
앞서 마친 단일 cluster 2개 중 하나를 master로 다른 하나를 slave로
설정한다.

1. master와 slave의 conf/hadoop-site.xml에서 localhost 부분을 master로 바꿔준다.
2. master의 conf/masters 파일에 master를 넣는다. (slave에서는 안해줘도 됨)
3. master의 conf/slaves에 master, slave를 넣는다. (slave에서는 안해줘도 됨)
4. 앞서 single cluster 설정시에 사용했던 file system directory를 지워준다.
   (… /dir/dfs)
5. master에서 namenode를 포맷한다. (bin/hadoop/ namenode -format)
6. master에서 bin/start-dfs.sh를 실행시켜 프로세스의 정상 가동 여부를 확인한다.
   1) master에서 뜨는 process :  Namenode, DataNode, SecondaryNamenode
   2) slave에서 뜨는 process : DataNode
7. master 및 slave에서 각각 로그내 이상유무를 확인한다. (ERROR 유무)
8. master에서 MapReduce 를 실행 시킨다.(bin/start-mapred.sh)
9. jps로 프로세스를 확인한다.
  1) master에 추가되는 process : TaskTracker, JobTracker
  2) slave에 추가되는 process : TaskTracker
10. master 및 slave에서 각각 로그내 이상유무를 확인한다. (ERROR 유무)

정상적으로 동작한다면, start-all.sh stop-all.sh 을 실행시킴으로써
dfs 및 mapreducer를 일괄적으로 시작/종료시킬 수 있다.

요약하면, master/slave의 dfs가 정상적으로 연동되고 있다면 외형적으로는
다음 두 조건을 만족시켜야 한다.

1. master 및 slave에서 각각 떠야할 프로세스들이 jps로 확인된다.
2. master 및 slave의 각 로그파일에 에러가 없다.사용자 삽입 이미지
(출처 : http://hadoop.apache.org/core/docs/current/hdfs_design.html)

Written by everydayminder

July 25, 2008 at 00:21

Posted in Hadoop

Ubuntu console mode로 로그인하기

leave a comment »

Ubuntu-desktop은 GUI모드로 부팅된다.

redhat 계열 리눅스와는 달리 runlevel을 수정하는 것만으로는 동작하지 않는다.

$ sudo mv /etc/rc3.d/S30gdm /etc/rc3.d/K30gdm

(내 경우에는 rc2.d에서 해줘야 먹혔음)

참고로,

Ubuntu에서 X윈도우를 터미널창에서 끄고 시작하려면,

$ sudo /etc/init.d/gdm start(stop, restart)

Ubuntu에서 X윈도우를 자동으로 실행하지 않고 터미널로 시작되도록 설정하는
명령어

$ sudo update-rc.d -f gdm remove

다시, X윈도우를 자동으로 띄우려면,

$ sudo update-rc.d gdm defaults

Written by everydayminder

July 22, 2008 at 09:15

Posted in linux

암호없이 SSH 키로 인증하기

leave a comment »

1. Localhost에서 인증하기

루트의 권한을 가진 ID로 로그인하여 다양하게 스크립트를 실행할 경우,
SSH 로그인을 필요로 할 수 있고, 이 때, 매번 password를 입력해야할 경우
번거로울 수 있다.

SSH는 암호 뿐만 아니라, public key, private key 기반의 인증을 제공하고
어렵지 않게 설정할 수 있다.

공개키는 암호화를 위해 사용되고, 공개키에 매핑되는 개인키로 복호화를 할 수 있다.
암호없이 SSH 로그인을 하려면, 클라이언트 시스템에서 키를 생성해야 한다.

ssh-keygen 명령어를 사용하여, 키를 생성할 수 있고,  -t 옵션을 통해 생성되는
키의 type(RSA/DSA)을 지정할 수 있다.

$ ssh-keygen -t rsa -P “”

와 같이 하면, .ssh 디렉토리에 id_rsa와 id_rsa.pub라는 키가 생성된다.
ir_rsa는 개인키, id_rsa.pub는 공개키이다.

로컬 머신에서 이 키를 자동으로 사용하기 위해,

$cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

로 복사한다.

그 후에,

$ ssh localhost
를 수행하여 확인해보면, localhost로 암호없이 키만으로 ssh 인증이 되는 것을
확인할 수 있다.

2. Remote host에서 인증하기

리모트호스트에서 암호없이 키만으로 SSH 인증하려면, 위와 같이 생성된 내 시스템의
키 값이 내가 접속할 시스템의 authorized_keys에 포함되어 있으면 된다.

생성된 공개키를 서버에 복사하기 위해, copy & paste를 하거나, FTP 등을 사용하여
복사하고 append 해도 된다.

SSH가 설치되어 있으므로, SCP를 통해 복사하려면 다음과 같이 한다.

$ scp .ssh/id_rsa.pub target_system_ip:/tmp/tmp_id_rsa.pub

이후, 리모트 시스템에 접속하여, 조금전에 복사한
/tmp/tmp_id_rsa.pub의 내용을 ./ssh/authorized_keys에 append 해주자.

* 복사한 tmp_id_rsa.pub가 authorized_keys에 정확히 append 되었다면,
꼭 지워줄 것.

* 내 시스템에서 remote system으로 ssh target_system_ip 하여 확인해보자.
성공적으로 설정되었다면, 암호 인증없이 연결되는 것을 확인할 수 있다.

Written by everydayminder

July 22, 2008 at 04:30

Posted in linux

Ubuntu에서 휠마우스 사용하기

leave a comment »

sudo vi /etc/X11/xorg.conf 를 실행하여
해당 파일을 편집한다.

Section “InputDevice”
    Identifier “Configured Mouse”
    Driver “mouse”
    Option “CorePointer”
    Option “Device” “/dev/input/mice”
    Option “Protocol” “ImPS/2
    Option “Buttons” “5”
    Option “ZAxisMapping” “4 5”
EndSection

마우스 디바이스 정의 부분 중, Protocol 부분을 위와 같이
바꿔주고 재시작하면, 휠 마우스의 휠이 동작한다.

Written by everydayminder

July 22, 2008 at 00:15

Posted in linux

Ubuntu에 Eclipse 설치하기

leave a comment »

1. 먼저, java를 설치한다.
    sudo apt-get install sun-java6-jdk

2. 시스템에서 기본적으로 동작할 java 를 선택해준다.
   sudo update-alternatives –config java

   원하는 java를 선택한다.

3. eclipse를 설치한다.
   sudo apt-get install eclipse

4. 원하는 패키지를 추가로 설치한다.
   sudo synaptic

   예) PyDev : Python 개발 플러그인

Written by everydayminder

July 21, 2008 at 06:53

Posted in linux

Hadoop Installation on Ubuntu Linux 7.10

leave a comment »

Related articles by Michael G. Noll
———————————-
1. Running Hadoop On Ubuntu Linux (Single Node Cluster)
http://wiki.apache.org/hadoop/Running_Hadoop_On_Ubuntu_Linux_%28Single-Node_Cluster%29

2. Running Hadoop On Ubuntu Linux (Multi Node Cluster)
http://www.michael-noll.com/wiki/Running_Hadoop_On_Ubuntu_Linux_%28Multi-Node_Cluster%29

[Comments]
1. I created a VMWare Team project file and added two instances of existing virtual machines.
2. Each VMWare instance has a single node cluster.

* IP alias name should be defined before loop back alias name (localhost) in ‘/etc/hosts’ file.

Written by everydayminder

July 17, 2008 at 06:05

Posted in Hadoop

HBase Installation (Standalone mode/local file system)

leave a comment »

Requirements
————-
– Java 1.5.x, preferably from Sun.
– Hadoop 0.16.x. This version of HBase will only run on Hadoop 0.16.x..
– ssh must be installed and sshd must be running to use Hadoop’s scripts
   to manage remote Hadoop daemons.
– HBase currently is a file handle hog. The usual default of 1024 on *nix systems
   is insufficient if you are loading any significant amount of data into regionservers.
  See the FAQ: Why do I see “java.io.IOException…(Too many open files)” in my logs?  for how to up the limit.


[C] Installation of HBase
————————–
(1) Java 1.5.x
    – installed java 1.6.x
    – Not sure whether 1.6.x will work
(2) Unzipped the Hadoop archive file (ver 1.3) at ~/hbase
(3) ssh & sshd configuration (execution)
    – sudo apt-get install openssh-server
    – sudo /etc/init.d/ssh start (stop)
(4) edit the limit number of file handlers
    – checked /etc/security/limits.conf but there is no option to edit for this


[C] HBase Configuration
————————
(1) ${HBASE_HOME} : the real location of hbase (/home/luran/hbase)
(2) modify JAVA_HOME information on ${HBASE_HOME}/conf/hbase-env.sh
(3) start HBase by ${HBASE_HOME}/bin/start_hbase.sh
(4) stop HBase by ${HBASE_HOME}/bin/stop-hbase.sh

Written by everydayminder

July 15, 2008 at 08:48

Posted in Hadoop