Starting Apache Hive
Also available as:
PDF

Start Hive as an end user

You can start Apache Hive as an end user authorized by Apache Ranger. As administrator, you must first set up the user in the operating system and in Ranger.

  • Create a user. For example, add a Linux user using the useradd operating system command.
  • Add the user to the Ranger list of users.
  • In Ranger, add the user name to Hive policies that grant full access to Hive.
  • In Ranger, add the user name to the HDFS all-path policy.
  • In Ambari, in Hive > Settings under Security, set Run as end user instead of Hive user to True.

    This is equivalent to setting hive.server2.enable.doAs=true in hive-site.xml.

  • In Ambari, if you get AccessControlException, add the following key and value to Hive > Configs > Advanced > Custom ranger-hive-security: xasecure.hive.describetable.showcolumns.authorization.optionand show-all
  1. Start Hive.
    beeline -u jdbc:hive2://myhiveserver.com:10000 -n user1 -p
  2. Enter a password at the prompt.
  3. Enter a query.
    SHOW DATABASES;
  4. Create a table in the default database.
    CREATE TABLE students (name VARCHAR(64), age INT, gpa DECIMAL(3,2));
  5. Insert data into the table.
    INSERT INTO TABLE students VALUES ('fred flintstone', 35, 1.28), ('barney rubble', 32, 2.32);