Updated on 2022-07-11 GMT+08:00

Shell

You can directly perform operations on HBase using Shell on the server. Versions of Shell interfaces of HBase need to be consistent with those in the open-source community. For details, see http://learnhbase.wordpress.com/2013/03/02/hbase-shell-commands/.

Methods of running the Shell command:

Go to any directory on the HBase client and run the following command:

hbase shell

Go to the running mode of the HBase command (also called CLI client connection).

hbase(main):001:0> 

Run the help command to obtain the help information of the HBase command parameters.

Precautions

The count command does not support conditional statistics. It supports only full table statistics.

Command to retrieve HBase replication metrics

All the required metrics will be added for the shell command "status".

  • Command to view replication source metrics.

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

    The output is as follows:

    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
  • Command to view replication sink metrics.

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

    The output is as follows:

    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
  • Command to view both replication source and replication sink metrics.

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

    The output is as follows:

    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