HBase의 테이블에 데이터를 저장하면, row key range 를 기준으로 테이블이 region server 에 걸쳐 나뉘게 된다.
그 split된 partition 개수를 RegionSplitter 를 이용하여 조절할 수 있다.
먼저 HBase table 의 partition 개수를 보는 방법을 설명한다.
HBase table 의 데이터는 HDFS 내에서 -ls 명령어를 통해 볼 수 있다.
이름이 word_10gb_b128 인 table 의 partition 개수를 보고 싶다면 아래처럼 볼 수 있다.
위 이미지를 보면 ( dot ( . ) 으로 시작하는 파일을 제외) 총 4개의 partition 으로 table 이 나뉜 것을 볼 수 있다.
위에서 사용한 똑같은 크기의 데이터를 partition 을 80개 짜리 테이블에 넣고 싶다고 하자.
아래 명령어를 통해 80개짜리 partition 을 갖는 테이블을 새로 생성한다.
hbase org.apache.hadoop.hbase.util.RegionSplitter [새로 만들 테이블 이름] [split 정책] -c [partition 개수] -f [column family 이름]
UniformSplit 정책 예)
hbase org.apache.hadoop.hbase.util.RegionSplitter word_10gb UniformSplit -c 80 -f cf
HexStringSplit 정책 예)
hbase org.apache.hadoop.hbase.util.RegionSplitter word_10gb HexStringSplit -c 80 -f cf
각 옵션값은 아래를 의미한다.
-c Create a new table with a pre-split number of regions
-D Override HBase Configuration Settings
-f Column Families to create with new table. Required with -c
-h Print this usage help
-o Max outstanding splits that have unfinished major compactions
-r Perform a rolling split of an existing region
hbase shell 에서 table list 를 확인해보면 새로 생성된 테이블을 볼 수 있다.
hdfs 를 살펴보면 80개의 partition 으로 split 된 것을 확인할 수 있다.
hdfs dfs -ls /hbase/data/default/word_10gb
추가 내용)
위의 내용대로 데이터를 넣었는데 심각한 데이터 치우침 현상을 발견
아래 명령어로 HBase 의 table partition 의 크기를 볼 수 있다.
hdfs dfs -du -h /hbase/data/default/word_10gb/
이게 데이터 자체의 format 때문인지, 아니면 위의 명령어 때문인지 모르겠음.
어느 정도 해결한 것을 여기서 제시한다.
HDFS 내의 HBase 데이터를 구체적으로 보고 싶다면 아래 명령어를 사용한다.
hdfs dfs -lsr -h /hbase/
참고
http://www.openkb.info/2014/05/hbase-region-split.html
http://dwgeek.com/splitting-hbase-tables-examples-best-practices.html/
https://stackoverflow.com/a/28736031/5868252
'HBase' 카테고리의 다른 글
[HBase] auto balance 방법 링크 (0) | 2019.11.21 |
---|---|
[HBase] 테이블 partition 개수와 block size 조절하는 방법 (0) | 2019.11.21 |
[HBase] org.apache.hadoop.hbase.util.FileSystemVersionException: hbase.version file is missing. 에러 해결 방법 (0) | 2019.11.14 |
[HBase] ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing 에러 해결 방법 (0) | 2019.11.14 |
[HBase] tsv, csv file load 하는 방법 (0) | 2019.11.06 |