hbase 명령어의 help에 나와있듯이 여러 방법으로 API 가 접근가능하다. 



/nosql/hbase-0.94.6/bin$ ./hbase

Usage: hbase <command>

where <command> an option from one of these categories:

PROCESS MANAGEMENT

 rest             run an HBase REST server

  thrift           run the HBase Thrift server

  thrift2          run the HBase Thrift2 server

  avro             run an HBase Avro server



참조할 Hbase Java API의 주소는 다음과 같다. java api와 아래 api 서버들을 비교하면 좋을듯 하다. 

http://hbase.apache.org/apidocs/




1. rest

rest 방식일때는 start 앞 rest를 써야 한다. 만약 rest 없이 start하면 접근하지 않는다. port를 넣지 않을때는 8080이 디폴트 포트가 된다.


./bin/hbase rest start -p <port> 


특이사항은 http 요청시 header 사항 xml, plain, json, protobuf 타입으로 지정해서 요청할 수 있다. 

http://wiki.apache.org/hadoop/Hbase/Stargate

http://blog.cloudera.com/blog/2013/03/how-to-use-the-apache-hbase-rest-interface-part-1/


XML 스키마 정보는 다음을 참조한다. 

http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd?view=markup


rest 관련 hbase 설정은 다음과 같다. (http://hbase.apache.org/book/config.files.html)

hbase.rest.threads.max

The maximum number of threads of the REST server thread pool. Threads in the pool are reused to process REST requests. This controls the maximum number of requests processed concurrently. It may help to control the memory used by the REST server to avoid OOM issues. If the thread pool is full, incoming requests will be queued up and wait for some free threads. The default is 100.

Default: 100

hbase.rest.threads.min

The minimum number of threads of the REST server thread pool. The thread pool always has at least these number of threads so the REST server is ready to serve incoming requests. The default is 2.

Default: 2








2. thrift


다음과 깉이 실행하여 thrift gateway 서버를 띄운다. 

bin/hbase thrift start


디폴트 포트는 9090 이다. (아마도..^^;;)


thrift 원본 파일은 다음과 같다. 

http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift?view=markup


thrift 관련 hbase 설정은 다음과 같다. (http://hbase.apache.org/book/config.files.html)

hbase.thrift.minWorkerThreads

The "core size" of the thread pool. New threads are created on every connection until this many threads are created.

Default: 16

hbase.thrift.maxWorkerThreads

The maximum size of the thread pool. When the pending request queue overflows, new threads are created until their number reaches this number. After that, the server starts dropping connections.

Default: 1000

hbase.thrift.maxQueuedRequests

The maximum number of pending Thrift connections waiting in the queue. If there are no idle threads in the pool, the server queues requests. Only when the queue overflows, new threads are added, up to hbase.thrift.maxQueuedRequests threads.

Default: 1000




3. thrift2


hbase 0.94부터 만들어졌다. (https://issues.apache.org/jira/browse/HBASE-1744)


다음과 깉이 실행하여 thrift2 gateway 서버를 띄운다. 

bin/hbase thrift2 start


thrift api가 old하고 java api와 비슷하지 않지만, thrift2는 concurrent를 지원하는 구조이다. 

http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/thrift2/generated/package-summary.html





4. avro

0.95부터는 deprecated될 예정이다. 

https://issues.apache.org/jira/browse/HBASE-6553




5.  c/c++ 

https://github.com/facebook/native-cpp-hbase-client





Posted by '김용환'

댓글을 달아 주세요