更新时间:2024-06-06 GMT+08:00
分享

HBase Shell接口介绍

您可以使用Shell在服务端直接对HBase进行操作。HBase的Shell接口同开源社区版本保持一致,请参见http://learnhbase.wordpress.com/2013/03/02/hbase-shell-commands/

Shell命令执行方法:

进入HBase客户端任意目录,执行以下命令。

hbase shell

进入HBase命令行运行模式(也称为CLI客户端连接),如下所示。

hbase(main):001:0> 

您可以在命令行运行模式中运行help命令获取HBase的命令参数的帮助信息。

注意事项

count命令不支持条件统计,仅支持全表统计。

获取HBase replication指标的命令

通过Shell命令“status”可以获取到所有需要的指标。

  • 查看replication source指标的命令。

    hbase(main):019:0> status 'replication', 'source'

    输出结果如下:

    version 2.2.3
    1 live servers
    BLR1000006595:
    SOURCE: PeerID=1, SizeOfLogQueue=0, ShippedBatches=0, ShippedOps=0, ShippedBytes=0, LogReadInBytes=1389, LogEditsRead=4, LogEditsFiltered=4, SizeOfLogToReplicate=0, TimeForLogToReplicate=0, ShippedHFiles=0, 
    SizeOfHFileRefsQueue=0, AgeOfLastShippedOp=0, TimeStampsOfLastShippedOp=Wed May 25 20:44:42 CST 2016, Replication Lag=0 PeerID=3, SizeOfLogQueue=0, ShippedBatches=0, ShippedOps=0, ShippedBytes=0, LogReadInBytes=1389, LogEditsRead=4, LogEditsFiltered=4, SizeOfLogToReplicate=0, TimeForLogToReplicate=0, ShippedHFiles=0,
    SizeOfHFileRefsQueue=0, AgeOfLastShippedOp=0, TimeStampsOfLastShippedOp=Wed May 25 20:44:42 CST 2016, Replication Lag=0 FailedReplicationAttempts=0
  • 查看replication sink指标的命令。

    hbase(main):020:0> status 'replication', 'sink'

    输出结果如下:

    version 2.2.3
    1 live servers
    BLR1000006595:
    SINK : AppliedBatches=0, AppliedOps=0, AppliedHFiles=0, AgeOfLastAppliedOp=0, TimeStampsOfLastAppliedOp=Wed May 25 17:55:21 CST 2016
  • 同时查看replication source和replication sink指标的命令。

    hbase(main):018:0> status 'replication'

    输出结果如下:

    version 2.2.3
    1 live servers
    BLR1000006595:
    SOURCE: PeerID=1, SizeOfLogQueue=0, ShippedBatches=0, ShippedOps=0, ShippedBytes=0, LogReadInBytes=1389, LogEditsRead=4, LogEditsFiltered=4, SizeOfLogToReplicate=0, TimeForLogToReplicate=0, ShippedHFiles=0, 
    SizeOfHFileRefsQueue=0, AgeOfLastShippedOp=0, TimeStampsOfLastShippedOp=Wed May 25 20:43:24 CST 2016, Replication Lag=0 PeerID=3, SizeOfLogQueue=0, ShippedBatches=0, ShippedOps=0, ShippedBytes=0, LogReadInBytes=1389, LogEditsRead=4, LogEditsFiltered=4, SizeOfLogToReplicate=0, TimeForLogToReplicate=0, ShippedHFiles=0,
    SizeOfHFileRefsQueue=0, AgeOfLastShippedOp=0, TimeStampsOfLastShippedOp=Wed May 25 20:43:24 CST 2016, Replication Lag=0 FailedReplicationAttempts=0
    SINK  : AppliedBatches=0, AppliedOps=0, AppliedHFiles=0, AgeOfLastAppliedOp=0, TimeStampsOfLastAppliedOp=Wed May 25 17:55:21 CST 2016

相关文档