Search code examples
javashellhbaseadmin

How to Access HBase Shell As Superuser? (Pre-Configured VM with CDH 5.7.2, HBase 1.2)


I'm using a pre-configured VM that runs Cloudera CDH 5.7.2 and HBase 1.2. Through Cloudera Manager, I recently configured HBase to perform authorization; however, now I need to create an HBase user with sufficient permission to create a table, perform puts/deletes/scans against the table, and then delete the table.

I learned how to access the HBase shell; however, I've just been typing hbase shell at the command line, which causes me to access it as the VM's currently authenticated user (root), and the VM's user lacks permission to grant the permissions that I need to associate with a particular HBase user, create the HBase user, etc.

How would I open an HBase shell as HBase's superuser? (I'm not 100% sure who the HBase superuser might be, since the VM was pre-configured.)

I feel like this should be similar to accessing Oracle SQLPLUS, first by authenticating to the machine, and then supplying Oracle user credentials to SQLPLUS to authenticate to Oracle as a sufficiently privileged user.

(I apologize in advance for this HBase rookie-level question.)


Solution

  • In order to write to the HDFS path /hbase you need to find out who owns that file.

    # hdfs dfs -ls /
    ...
    drwxr-xr-x   - hbase supergroup          0 2017-07-14 07:48 /hbase
    drwxrwxrwt   - hdfs  supergroup          0 2017-07-14 07:48 /tmp
    ....
    

    Most likely it is the service user hbase. If it is, then run as hbase using sudo.

    # sudo -u hbase hbase shell