Adding hive jars permanently

2019-04-07 07:26发布

Is there any way I can add hive jars permanently instead of adding at session level in hive shell?

Any help would be appreciated

标签: hadoop hive
3条回答
劳资没心,怎么记你
2楼-- · 2019-04-07 07:55

these can be done by two steps

  1. Hive Client should be avalable in all nodes.
  2. Hive Live location should be defined in hadoop-env.sh CLASSPATH and the same file should be updated in entired Hadoop Clueter.

{hadoop-env.sh should be update with CLASSPATH of hive and other location for user defined custom jars and common location which available in entire cluster }

You also need to restart the hive/hadoop to take effect if after changes it dnt work.

查看更多
冷血范
3楼-- · 2019-04-07 07:59

You will have to put the jar in the lib folder of hadoop or hive in all your nodes.

查看更多
\"骚年 ilove
4楼-- · 2019-04-07 08:00

In the hiveserver2 host, create a location something like /var/lib/hive and add all the necessary jars inside that folder. Edit the hive-site.xml and mention all these jars in the property hive.aux.jars.path

Eg: ADD JAR /home/amal/hive/amaludf.jar ADD JAR /home/amal/hive/amaludf2.jar

Instead of using the above commands in each session, you can define it for all sessions.

Create a location for storing these jars in the hiveserver host.

mkdir /var/lib/hive

Add all these jars to that directory

Set the property in hive-site.xml

<property>
  <name>hive.aux.jars.path</name>
  <value>/var/lib/hive</value>
</property>

Restart the hiveserver2 after doing this modification.

Instead of creating a directory and putting all the jars, you can specify paths of individual jars also. The only condition is that all these jars should be present in the hiveserver host.

Eg:

<property>
  <name>hive.aux.jars.path </name>
  <value>file:///home/amal/hive/udf1.jar,file:///usr/lib/hive/lib/hive-hbase-handler.jar</value>
</property>
查看更多
登录 后发表回答