hbase의 cmd 는 shell script과 ruby를 기반으로 되어 있다.
bin/hbase는 shell script이고, hirb.rb라는 ruby 파일을 호출하도록 되어 있다.
if [ "$COMMAND" = "shell" ] ; then
# eg export JRUBY_HOME=/usr/local/share/jruby
if [ "$JRUBY_HOME" != "" ] ; then
CLASSPATH="$JRUBY_HOME/lib/jruby.jar:$CLASSPATH"
HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
fi
CLASS="org.jruby.Main -X+O ${JRUBY_OPTS} ${HBASE_HOME}/bin/hirb.rb"
1. prompt
hirb.rb는 내부적으로 ruby의 irb (Interactive Ruby Shell) 을 이용하도록 되어 있다.
hbase(main):001:0>
3개의 word가 colon separator(:) 으로 나누어진 상태로 스크립트를 사용할 수 있다.
첫번째 word는 main object이름를 출력하고, 두번째 word는 line number를 의미하고, 마지막 word는 semantic indentation이다.
hbase(main):002:0> list 'test'
TABLE
test
1 row(s) in 0.9690 seconds
irb 정보(http://ruby-doc.org/docs/ProgrammingRuby/html/irb.html, http://linux.die.net/man/1/irb)를 통해 확인해보니. 다음과 같다.
Flag | Description |
%N | Current command. |
%m | to_s of the main object (self). |
%M | inspect of the main object (self). |
%l | Delimiter type. In strings that are continued across a line break, %l will display the type of delimiter used to begin the string, so you'll know how to end it. The delimiter will be one of " , ' , / , ] , or ` . |
%ni | Indent level. The optional number n is used as a width specification to printf, as printf("%nd") . |
%nn | Current line number (n used as with the indent level). |
%% | A literal percent sign. |
For instance, the default prompt mode is defined as follows:
IRB.conf[:PROMPT_MODE][:DEFAULT] = { :PROMPT_I => "%N(%m):%03n:%i> ", :PROMPT_S => "%N(%m):%03n:%i%l ", :PROMPT_C => "%N(%m):%03n:%i* ", :RETURN => "%s\n" } |
hbase> debug <RETURN>
$ ./bin/hbase shell -d
$ more .irbrc require 'irb/ext/save-history' IRB.conf[:SAVE_HISTORY] = 100 IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
출처: http://hbase.apache.org/shell.html
'nosql' 카테고리의 다른 글
[hbase] hbase 2013 발표 자료 공개 (0) | 2013.07.11 |
---|---|
[hbase] regsion서버에 G1 gc 적용으로 좋아진 예 (0) | 2013.07.09 |
[hbase] Phoenix 성능 (0) | 2013.06.24 |
[hbase] ROOT catalog table 삭제 (0) | 2013.06.20 |
[hbase] 제한적인 트랙잭션 (0) | 2013.06.20 |