Support Questions

Find answers, ask questions, and share your expertise

HiveMetaStore logs not showing logs from custom event listener using HiveMetaStoreEventListener

avatar
New Contributor

I am trying to create a very basic Custom HiveMetastore Event Listener using the following blog. I have successfully created the JAR file and have executed the following steps on beeline but the event listener logs are still not getting displayed in /var/log/hive/hivemetastore.log


Followed Tutorial=> https://towardsdatascience.com/apache-hive-hooks-and-metastore-listeners-a-tale-of-your-metadata-903...

Git Repository=> https://github.com/mesmacosta/hive-custom-metastore-listener

Step 1: Added JAR to hdfs

hadoop fs -put custom-metastore-listener.jar /user/data/

Step 2: Added JAR from HDFS to the hive 

beeline> add jar hdfs:///user/data/custom-metastore-listener.jar; 

Step3: Set event listener

beeline> set hive.metastore.event.listeners=com.medium.hive.metastore.listerner.CustomListener;

Step4: Run create table command and check hivemetastore logs.

beeline> CREATE TABLE test(name string) STORED AS ORC;

  
But the log does not show anything from a custom event listener. Apart from this, I have also tried adding JAR through hive-site.xml and also tried restarting hive metastore service from ambari but it is still not working. Any help on this would be highly appreciated.
Thank You,
Aakash

1 ACCEPTED SOLUTION

avatar
New Contributor

I have found a solution to the above problem. The jar file needs to be placed under /usr/hdp/version-number/hive/auxlib as described in this question 
https://community.cloudera.com/t5/Support-Questions/How-add-path-with-aux-jars-for-Hive-client/td-p/...
After placing jar under auxlib, I changed the hive.metastore.event.listeners property from ambari. There are three values of the same property name under ambari-> hive->configs->advanced
1) Advanced hive-interactive-site
2) Advanced hive-site
3) Advanced hivemetastore-site
changed all of them to com.medium.hive.metastore.listerner.CustomListener;
Restarted all hive services and the problem was solved. 
Hope this helps someone.
Regards,
Aakash

View solution in original post

1 REPLY 1

avatar
New Contributor

I have found a solution to the above problem. The jar file needs to be placed under /usr/hdp/version-number/hive/auxlib as described in this question 
https://community.cloudera.com/t5/Support-Questions/How-add-path-with-aux-jars-for-Hive-client/td-p/...
After placing jar under auxlib, I changed the hive.metastore.event.listeners property from ambari. There are three values of the same property name under ambari-> hive->configs->advanced
1) Advanced hive-interactive-site
2) Advanced hive-site
3) Advanced hivemetastore-site
changed all of them to com.medium.hive.metastore.listerner.CustomListener;
Restarted all hive services and the problem was solved. 
Hope this helps someone.
Regards,
Aakash