HBase
  1. HBase
  2. HBASE-11431

Add support of running from command line for 'hbase shell'

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Not A Problem
    • Affects Version/s: 0.89-fb
    • Fix Version/s: 0.89-fb
    • Component/s: Admin
    • Labels:

      Description

      Add support of running from command line for 'hbase shell'.

      Now you can execute shell command from the bash like this:

      bin/hbase shell --exec='scan ".META"'

      The result can be piped to grep or other command.

        Activity

        Hide
        Demai Ni added a comment -

        currently. I usually did this to ge the same functionality.

        1) put the hbase shell commands in to a txt file. For example, I put this line
        put 't1_dn15','row5','cf1:q1','row5_from15'
        into file cmd.txt
        2) then run this
        $hbase shell < cmd.txt

        It will work well like this

        $ hbase shell < cmd.txt 
        HBase Shell; enter 'help<RETURN>' for list of supported commands.
        Type "exit<RETURN>" to leave the HBase Shell
        Version 0.99.0-SNAPSHOT, redfe6592dfcab57f6f2a78f73d4fc788e62707e9, Fri Jun 27 15:36:44 PDT 2014
        
        put 't1_dn15','row5','cf1:q1','row5_from15'
        0 row(s) in 0.4750 seconds
        
        

        And user can certainly put more than one command in the text file. So will that serve the requirement of this jira?

        Show
        Demai Ni added a comment - currently. I usually did this to ge the same functionality. 1) put the hbase shell commands in to a txt file. For example, I put this line put 't1_dn15','row5','cf1:q1','row5_from15' into file cmd.txt 2) then run this $hbase shell < cmd.txt It will work well like this $ hbase shell < cmd.txt HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.99.0-SNAPSHOT, redfe6592dfcab57f6f2a78f73d4fc788e62707e9, Fri Jun 27 15:36:44 PDT 2014 put 't1_dn15','row5','cf1:q1','row5_from15' 0 row(s) in 0.4750 seconds And user can certainly put more than one command in the text file. So will that serve the requirement of this jira?
        Hide
        @deprecated Yi Deng added a comment -

        Thanks for the comment.

        The method you provide is not convinient for creating a file each time. But somebody else just tell me I can do things like:

        echo "put 't1_dn15','row5','cf1:q1','row5_from15'" | hbase shell

        This is simple enough.

        Show
        @deprecated Yi Deng added a comment - Thanks for the comment. The method you provide is not convinient for creating a file each time. But somebody else just tell me I can do things like: echo "put 't1_dn15','row5','cf1:q1','row5_from15'" | hbase shell This is simple enough.
        Hide
        Sean Busbey added a comment -

        Does the 0.89-fb branch properly exit with non-zero status if something goes wrong with a command? If not, should this ticket be repurposed for backporting HBASE-11658 to 0.89-fb?

        Show
        Sean Busbey added a comment - Does the 0.89-fb branch properly exit with non-zero status if something goes wrong with a command? If not, should this ticket be repurposed for backporting HBASE-11658 to 0.89-fb?
        Hide
        Amit Kabra added a comment -

        Since : echo "put 't1_dn15','row5','cf1:q1','row5_from15'" | hbase shell
        solves the purpose, is there still any work left on this jira ?

        Show
        Amit Kabra added a comment - Since : echo "put 't1_dn15','row5','cf1:q1','row5_from15'" | hbase shell solves the purpose, is there still any work left on this jira ?
        Hide
        Yi Deng added a comment -

        Amit Kabra I'm ok with close this Jira now.

        Show
        Yi Deng added a comment - Amit Kabra I'm ok with close this Jira now.

          People

          • Assignee:
            Unassigned
            Reporter:
            @deprecated Yi Deng
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development