hbase的shell脚本是通过ruby实现的

hbase中的shell命令是通过ruby实现的,所有的命令都在

hbase-0.92.1-cdh4.1.2\src\main\ruby

目录下面,在shell中通过hbase shell启动hbase-->hirb.rb 加载ruby文件,通过
hbase-0.92.1-cdh4.1.2\src\main\ruby\shell.rb

中配置的命令实现对hbase的操作,下面是shell.rb中配置部分代码。

# Load commands base class
require 'shell/commands'

# Load all commands
Shell.load_command_group(
  'general',
  :full_name => 'GENERAL HBASE SHELL COMMANDS',
  :commands => %w[
    status
    version
    whoami
  ]
)

Shell.load_command_group(
  'ddl',
  :full_name => 'TABLES MANAGEMENT COMMANDS',
  :commands => %w[
    alter
    create
    describe
    disable
    disable_all
    is_disabled
    drop
    drop_all
    enable
    enable_all
    is_enabled
    exists
    list
    show_filters
    alter_status
    alter_async
  ]
)

Shell.load_command_group(
  'dml',
  :full_name => 'DATA MANIPULATION COMMANDS',
  :commands => %w[
    count
    delete
    deleteall
    get
    get_counter
    incr
    put
    scan
    truncate
  ]
)

Shell.load_command_group(
  'tools',
  :full_name => 'HBASE SURGERY TOOLS',
  :comment => "WARNING: Above commands are for 'experts'-only as misuse can damage an install",
  :commands => %w[
    assign
    balancer
    balance_switch
    close_region
    compact
    flush
    major_compact
    move
    split
    unassign
    zk_dump
    hlog_roll
  ]
)

Shell.load_command_group(
  'replication',
  :full_name => 'CLUSTER REPLICATION TOOLS',
  :comment => "In order to use these tools, hbase.replication must be true. enabling/disabling is currently unsupported",
  :commands => %w[
    add_peer
    remove_peer
    list_peers
    enable_peer
    disable_peer
    start_replication
    stop_replication
  ]
)

Shell.load_command_group(
  'security',
  :full_name => 'SECURITY TOOLS',
  :comment => "NOTE: Above commands are only applicable if running with the AccessController coprocessor",
  :commands => %w[
    grant
    revoke
    user_permission
  ]
)


如果要更深入了解可以访问http://www.tuicool.com/articles/BbuaQr 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值