By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .

Since Hive 3.x, new authentication feature for HiveServer2 client is added. When starting HiveServer2 service (Hive version 3.0.0), you may encounter errors like:

‘HiveServer2 metastore.RetryingMetaStoreClient: RetryingMetaStoreClient trying reconnect as [username]  (auth:SIMPLE).

By looking into log details of Hive, you may find the following recommendation:

metastore.HiveMetaStore: Not authorized to make the get_current_notificationEventId call. You can try to disable metastore.metastore.event.db.notification.api.auth

By default, that configuration is configured as following:

<property>
     <name>hive.metastore.event.db.notification.api.auth</name>
     <value>true</value>
     <description>
       Should metastore do authorization against database notification related APIs such as get_next_notification.
       If set to true, then only the superusers in proxy settings have the permission
     </description>
   </property>

So to fix the issue, follow these two steps.

Step 1 - setup proxy settings

In Hadoop core-site.xml configuration file, add the following configurations:

<property>
     <name>hadoop.proxyuser.$superuser.hosts</name>
     <value>*</value> </property>
<property>
     <name>hadoop.proxyuser.$superuser.groups</name>
     <value>*</value> </property>

Replace $superuser with your user account. For me, I am running as user fahao. Thus I’ve added the following configuration:

<property>
     <name>hadoop.proxyuser.fahao.hosts</name>
     <value>*</value>
< /property>
<property>
     <name>hadoop.proxyuser.fahao.groups</name>
     <value>*</value>
< /property>

If I don’t add the above configuration, my user account won’t be able to impersonate hive user.

java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: fahao is not allowed to impersonate hive (state=08S01,code=0)

Step 2 (optional) - Update Hive metadata configuration

Update your Hive configuration file hive-site.xml to include the following settings:

<property>
     <name>hive.metastore.event.db.notification.api.auth</name>
     <value>false</value>
     <description>
       Should metastore do authorization against database notification related APIs such as get_next_notification.
       If set to true, then only the superusers in proxy settings have the permission
     </description>
   </property>

Without this, you need to specify username when connecting to Hive using beeline:

beeline> !connect jdbc:hive2://localhost:10000/default -n username

image

If anonymous connection is allowed, User Name will show as anonymous in HiveServer2 web UI otherwise the connected username will show there.

After these changes, restart Hadoop and HiveServer2 services, the problem should be resolved.

$HIVE_HOME/bin/hive --service metastore &
$HIVE_HOME/bin/hive --service hiveserver2 &
#Or
$HIVE_HOME/bin/hiveserver2 &

Try connect to HiveServer2 via beeline CLI

Once the service starts succesfully, you can view HiveServer2 Web UI via the following URL:

http://localhost:10002/

image

You can use beeline to query the Hive databases:

beeline> !connect jdbc:hive2://localhost:10000/default
Connecting to jdbc:hive2://localhost:10000/default
Enter username for jdbc:hive2://localhost:10000/default: hive
Enter password for jdbc:hive2://localhost:10000/default:
Connected to: Apache Hive (version 3.0.0)
Driver: Hive JDBC (version 3.0.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:10000/default> show databases;
+----------------+ | database_name  | +----------------+ | default        | | test_db        | +----------------+ 2 rows selected (0.859 seconds)
info Last modified by Raymond at 2 months ago * This page is subject to Site terms.

More from Kontext

local_offer hive local_offer hdfs

visibility 60
thumb_up 0
access_time 2 months ago

In Hive, there are two types of tables can be created - internal and external table. Internal tables are also called managed tables. Different features are available to different types. This article lists some of the common differences.  Internal table By default, Hive creates ...

open_in_new View open_in_new Hadoop

Schema Merging (Evolution) with Parquet in Spark and Hive

local_offer parquet local_offer pyspark local_offer spark-2-x local_offer hive local_offer hdfs

visibility 298
thumb_up 0
access_time 3 months ago

Schema evolution is supported by many frameworks or data serialization systems such as Avro, Orc, Protocol Buffer and Parquet. With schema evolution, one set of data can be stored in multiple files with different but compatible schema. In Spark, Parquet data source can detect and merge sch...

open_in_new View open_in_new Spark + PySpark

local_offer lite-log local_offer spark local_offer pyspark

visibility 2260
thumb_up 0
access_time 10 months ago

When creating Spark date frame using schemas, you may encounter errors about “field **: **Type can not accept object ** in type <class '*'>”. The actual error can vary, for instances, the following are some examples: field xxx: BooleanType can not accept object 100 in type ...

open_in_new View open_in_new Spark + PySpark

local_offer SQL local_offer hive

visibility 140
thumb_up 0
access_time 5 months ago

In Oracle database, you can select from dual table if you only want to return a one row result set. In many other databases, the query engine supports select directly from constant values without specifying a table name. 

open_in_new View open_in_new Code snippets

info About author

Kontext dark theme mode

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward
Kontext Column

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us