공통
JAVA_HOME 환경변수 설정
로컬 단일 서버로 구축
hbase-site.xml에 데이터 디렉토리 지정
dataDir 디렉토리 변경
hbase.rootdir 항목과 hbase.zookeeper.property.dataDir 항목을 보면 /tmp로 되어 있는데 reboot 후에 삭제될 수 있으니 다른 디렉토리로 변경할 것
<property>
<name>hbase.rootdir</name>
<value>file:///Users/terzeron/apps/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/Users/terzeron/apps/zookeeper</value>
</property>
HBase 서버 시작
start-hbase.sh
로그 확인
tail -f로 로그 메시지 감시할 것
HBase 서버 중단
stop-hbase.sh
HBase 클라이언트 실행
hbase shell
테이블 생성
create 'test', 'cf'
cf는 column family를 의미함
테이블 목록 조회
list 'test'
레코드 추가
put 'test', 'row1', 'cf:a', 'value1'
레코드 추가
put 'test', 'row2', 'cf:b', 'value2'
레코드 추가
put 'test', 'row3', 'cf:c', 'value3'
row1 레코드, cf:a 컬럼, value1 값
테이블 생성 시에 지정한 column family prefix인 'cf'를 붙여서 사용함
테이블 레코드 목록 조회
scan 'test'
레코드 꺼내오기
get 'test', 'row1'
레코드 제한 걸기
disable 'test'
list는 되지만, scan, get 등의 op가 안 됨
레코드 제한 해제
enable 'test'
테이블 제거
drop 'test'
drop하기 위해서는 먼저 disable되어야 함
분산 서버로 설정하려면 (local에서 유사 분산 환경 구축 )
hbase-site.xml에 추가
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
hbase-site.xml에서 변경
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
시작
bin/start-hbase.sh
java process 확인
jps
HMaster와 HQuorumPeer, HRegionServer가 실행되었는지 확인할 것
port mapping
16201: HRegionServer
/hbase 디렉토리 안에 WALs, data 등의 파일이 만들어졌는지 확인
hdfs dfs -ls /hbase