Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-5842

Passing shell commands as an argument

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Later
    • Affects Version/s: 0.94.0
    • Fix Version/s: None
    • Component/s: shell
    • Labels:
      None

      Description

      Many times we've required scans of .META. to analyze issues with the cluster we work on, and to have the result in a file we can pass around we usually end up doing something like:

      echo "scan '.META.'| hbase shell > meta-scan.txt

      This can rather be simplified as something like the following instead, with support for a commands reading argument:

      hbase shell -c "scan '.META.'"

      [Note though: File reading is possible already, i.e. {{hbase shell file.hs}}, but then thats two steps and we usually don't keep a file around for just a meta table scan.]

        Activity

        Hide
        qwertymaniac Harsh J added a comment -

        Sean Busbey - It partially improves the first form, but I still feel a -c option may be preferable, no?

        That said I've not seen need for scanning meta lately (HBase has improved a lot!) so I'll resolve this one as 'Later' as there's no demand on this.

        I cannot also think of many other reasons one would need to be piping to the current shell instead of using the file option (if at all).

        Show
        qwertymaniac Harsh J added a comment - Sean Busbey - It partially improves the first form, but I still feel a -c option may be preferable, no? That said I've not seen need for scanning meta lately (HBase has improved a lot!) so I'll resolve this one as 'Later' as there's no demand on this. I cannot also think of many other reasons one would need to be piping to the current shell instead of using the file option (if at all).
        Hide
        busbey Sean Busbey added a comment -

        Harsh J do the changes in HBASE-11658 satisfy your needs here?

        Show
        busbey Sean Busbey added a comment - Harsh J do the changes in HBASE-11658 satisfy your needs here?
        Hide
        stack stack added a comment -

        @Jon http://svn.apache.org/viewvc/hbase/tags/0.18.1/bin/ has a Formatter.rb class. You have to go back further to find our being able to format output as html: http://svn.apache.org/viewvc/hbase/tags/0.1.3/src/java/org/apache/hadoop/hbase/hql/TableFormatterFactory.java?view=markup

        @Harsh -c sounds good.... easier than echo blah blah.

        Show
        stack stack added a comment - @Jon http://svn.apache.org/viewvc/hbase/tags/0.18.1/bin/ has a Formatter.rb class. You have to go back further to find our being able to format output as html: http://svn.apache.org/viewvc/hbase/tags/0.1.3/src/java/org/apache/hadoop/hbase/hql/TableFormatterFactory.java?view=markup @Harsh -c sounds good.... easier than echo blah blah.
        Hide
        qwertymaniac Harsh J added a comment -

        It exists in 0.90+ AFAIK. However this JIRA is about adding in a -c option not just for META scan but also to run any other series of ;-separated commands without having to echo and pipe it into the shell.

        Show
        qwertymaniac Harsh J added a comment - It exists in 0.90+ AFAIK. However this JIRA is about adding in a -c option not just for META scan but also to run any other series of ;-separated commands without having to echo and pipe it into the shell.
        Hide
        jmhsieh Jonathan Hsieh added a comment -

        A greppable dump would be really helpful for system tests and for surgery. What versions of hbase did this exist in?

        Show
        jmhsieh Jonathan Hsieh added a comment - A greppable dump would be really helpful for system tests and for surgery. What versions of hbase did this exist in?
        Hide
        stack stack added a comment -

        We used to have it so you could pass a formatter class that the shell would use. Default is console formatting. We used to have an html output one which was useful when you could type in shell commands on ui and get results as an html page. Another formatter would emit results per line so greppable.

        Show
        stack stack added a comment - We used to have it so you could pass a formatter class that the shell would use. Default is console formatting. We used to have an html output one which was useful when you could type in shell commands on ui and get results as an html page. Another formatter would emit results per line so greppable.
        Hide
        jmhsieh Jonathan Hsieh added a comment -

        Harsh, I would add that the output from the shell of that particular example is too clever with formatting and ends up being cumbersome to use with standard unix parsing tools.

        For that particular command, I've hacked the HFile tool do dump contents in an grep'able format.

        Are you looking for that command in particular or are there more cases?

        Maybe we should add a hbase-admin command that has shortcuts to utility methods like HLog, HFile, and something like DumpMeta?

        Show
        jmhsieh Jonathan Hsieh added a comment - Harsh, I would add that the output from the shell of that particular example is too clever with formatting and ends up being cumbersome to use with standard unix parsing tools. For that particular command, I've hacked the HFile tool do dump contents in an grep'able format. Are you looking for that command in particular or are there more cases? Maybe we should add a hbase-admin command that has shortcuts to utility methods like HLog, HFile, and something like DumpMeta?

          People

          • Assignee:
            Unassigned
            Reporter:
            qwertymaniac Harsh J
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development