Created on 07-01-2020 05:49 AM - edited 07-01-2020 05:52 AM
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
Created 07-01-2020 08:39 PM
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
Created 07-01-2020 08:39 PM
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