Skip to content

Standalone HBase 설치

Jong cheol, Kim edited this page Jul 25, 2016 · 2 revisions

Standalone HBase instance (using a local filesystem)

1. JDK Install

2. HBase Install

  • HBase를 다운받는다.

  • 압축 해제

      tar xzvf hbase-<version>-bin.tar.gz
  • 압축이 해제된 폴더로 이동

      cd hbase-<version>
  • conf/habse-site.xml 파일의 내용을 아래와 같이 변경 (경로는 자신의 Home 으로 수정 한다)

      <configuration>
        <property>
          <name>hbase.rootdir</name>
          <value>file:///home/testuser/hbase</value>
        </property>
        <property>
          <name>hbase.zookeeper.property.dataDir</name>
          <value>/home/testuser/zookeeper</value>
        </property>
      </configuration>
  • HBase 실행

      bin/start-habse.sh

3. HBase Test

  • HBase 접속

      ./bin/hbase shell
  • Table 생성

      hbase(main):001:0> create 'test', 'cf'
      0 row(s) in 0.4170 seconds
  • Table 목록 조회

      hbase(main):002:0> list 'test'
      TABLE
      test
      1 row(s) in 0.0180 seconds
    
      => ["test"]
  • Table에 데이터 삽입

      hbase(main):003:0> put 'test', 'row1', 'cf:a', 'value1'
      0 row(s) in 0.0850 seconds
    
      hbase(main):004:0> put 'test', 'row2', 'cf:b', 'value2'
      0 row(s) in 0.0110 seconds
    
      hbase(main):005:0> put 'test', 'row3', 'cf:c', 'value3'
      0 row(s) in 0.0100 seconds
  • Table에 있는 데이터 범위 조회

      hbase(main):006:0> scan 'test'
      ROW                                      COLUMN+CELL
       row1                                    column=cf:a, timestamp=1421762485768, value=value1
       row2                                    column=cf:b, timestamp=1421762491785, value=value2
       row3                                    column=cf:c, timestamp=1421762496210, value=value3
      3 row(s) in 0.0230 seconds
  • Table에 있는 데이터 단건 조회

      hbase(main):007:0> get 'test', 'row1'
      COLUMN                                   CELL
       cf:a                                    timestamp=1421762485768, value=value1
      1 row(s) in 0.0350 seconds
  • Table 사용가능 불가능 변경

      hbase(main):008:0> disable 'test'
      0 row(s) in 1.1820 seconds
    
      hbase(main):009:0> enable 'test'
      0 row(s) in 0.1770 seconds
  • Table 삭제

      hbase(main):011:0> drop 'test'
      0 row(s) in 0.1370 seconds

참고 사이트

http://hbase.apache.org/book.html#quickstart