A simple but powerful replacement for ./hbase shell
Execute:
$ bash <(curl -sk https://raw.githubusercontent.com/xxjapp/HBShell/master/install.sh)
NOTE: For hbase 0.20.4 execute:
$ bash <(curl -sk https://raw.githubusercontent.com/xxjapp/HBShell/master/install_0204.sh)
$ ruby run.rb
** WARNING : 'clear'(and its alias) will clear contents of all tables in database
** NOTE : use 'clear! ...' to force clear
usage : clear [table_pattern]
example : clear ^test_table
alias : [cle, clr]
** NOTE: for permanent change of quorums, modify hosts file
[windows: C:\Windows\System32\drivers\etc\hosts / linux: /etc/hosts]
or change value of 'hbase.zookeeper.quorum' in 'hbase-site.xml'
usage : connect [quorums_separated_by_comma]
example : connect 172.17.1.206
alias : [con]
usage : count [table_pattern [row_pattern [family_pattern [qualifier_pattern [value_pattern]]]]]
example : count ^135530186920f18b9049b0a0743e86ac3185887c5d .
alias : [cnt]
usage : create table_name family_name1 [family_name2 ...]
example : create test_table family1 family2
alias : [c, cre]
** WARNING : 'delete'(and its alias) will delete all tables in database
** NOTE : use 'delete! ...' to force delete
usage : delete [table_name [row_key [family_name [qualifier_name]]]]
example : delete test_table family1
alias : [d, del]
usage : describe [table_pattern [family_pattern]]
example : describe ^135530186920f18b9049b0a0743e86ac3185887c5d
alias : [des]
usage : export [table_name [row_key [family_name [qualifier_name]]]]
example : export 135530186920f18b9049b0a0743e86ac3185887c5d f30dab5e-4b42-11e2-b324-998f21848d86file
alias : [ex]
usage : filter [table_pattern [row_pattern [family_pattern [qualifier_pattern [value_pattern]]]]] other_pattern
example : filter ^135530186920f18b9049b0a0743e86ac3185887c5d fullpath
alias : [f]
usage : get [table_name [row_key [family_name [qualifier_name]]]]
example : get 135530186920f18b9049b0a0743e86ac3185887c5d f30dab5e-4b42-11e2-b324-998f21848d86file
alias : [g]
usage : help [topic1 [topic2 ...]]
example : help filter get
alias : [h]
usage : history [count [pattern]]
example : history 3 get
alias : [his]
usage : import [table_name [row_key [family_name [qualifier_name]]]]
example : import 135530186920f18b9049b0a0743e86ac3185887c5d f30dab5e-4b42-11e2-b324-998f21848d86file
alias : [im]
usage : list [table_pattern [row_pattern [family_pattern [qualifier_pattern [value_pattern]]]]]
example : list ^135530186920f18b9049b0a0743e86ac3185887c5d file
alias : [l, ls]
** NOTE: for permanent change of multiline status, modify setting file
[conf/config.ini]
usage : multiline [0, false or 1, true]
example : multiline false
alias : [m]
usage : put table_name row_key family_name qualifier_name value
example : put test_table row1 family1 qualifier1 value1
alias : [p]
usage : quit
example : quit
alias : [e, q, exit]
** NOTE: for permanent change of readonly status, modify setting file
[conf/config.ini]
usage : readonly [0, false or 1, true]
example : readonly false
alias : [ro]
** WARNING : 'delete'(and its alias) will delete all tables in database
** NOTE : use 'delete! ...' to force delete
usage : reg_delete [table_pattern [row_pattern [family_pattern [qualifier_pattern [value_pattern]]]]]
example : reg_delete ^test_table family1
alias : [rd]
usage : rename old_table_name new_table_name
example : rename test_table test_table2
alias : [rn, ren]
usage : run file_path
example : run ./commands.hbc
alias : [r]
usage : scan [table_pattern [row_pattern [family_pattern [qualifier_pattern [value_pattern]]]]]
example : scan ^135530186920f18b9049b0a0743e86ac3185887c5d . fileinfo
alias : [s]
** NOTE: for permanent change of showtimestamp status, modify setting file
[conf/config.ini]
usage : showtimestamp [0, false or 1, true]
example : showtimestamp false
alias : [st]
** NOTE: for permanent change of showvaluelength status, modify setting file
[conf/config.ini]
usage : showvaluelength [0, false or 1, true]
example : showvaluelength false
alias : [sl]
** NOTE: for permanent change of usefamilycache status, modify setting file
[conf/config.ini]
usage : usefamilycache [0, false or 1, true]
example : usefamilycache false
alias : [fc]
usage : version
example : version
alias : [v, ver]
- all control keys are not usable before jline added
- thanks to jline, arrow left/right/up/down are usable, but
- backspace and delete are switched (resolved by MyUnixTerminal)
- home/end, page up/down are not usable (resolved by MyConsoleReader partially)
- the following text in pasting text will act as control keys
- '1~' -> home, go to begin of line
- '2~' -> insert, do nothing
- '4~' -> end, go to end of line
- '5~' -> page up, move to first history entry
- '6~' -> page down, move to last history entry
- all commands can be added with a row limit number to only operate on first found rows
- e.g. scan10 table . family qualifier value
- all commands can be added with a '*' mark to execute without omitting series of qualifiers, thus 'f0, ..., f3' => 'f0, f1, f2, f3'
- some commands always use this mode, eg. 'export'
- e.g. get* table key
- all commands can be added with a '-' mark to execute without logging to console and normal log file
- e.g. scan- table
- all commands can be added with a '^' mark to execute without logging result file
- e.g. scan^ table
- all commands can be added with a '!' mark to execute without confirmation
- e.g. delete! table key family qualifier
- put commands can be added with a '+' mark to put a numerical value added to the old numerical value
- e.g. put+ table key family qualifier 22
- put commands can be added with a '~' mark to append value to the old value
- e.g. put~ table key family qualifier value
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request