knktc's Notes

python, cloud, linux...

0%

Configure HiveServer2 to Use a UDF in Cloudera Manager

HiveServer2 makes it much easier to run Hive queries remotely, but unfortunately it does not provide any especially convenient way to use your own UDF jar directly.

So before using a UDF through HiveServer2, some extra configuration is required. The method described here is suitable for CDH4 users.

If HiveServer2 needs to use a UDF, first place the UDF jar on the server where HiveServer2 runs, and note the directory path.

For example, suppose the jar is stored as:

1
/opt/cloudera/aux_jars/json-serde.jar

Then configure HiveServer2 in Cloudera Manager like this:

1
2
3
4
5
6
7
8
9
10
1. In the HiveServer2 "Hive Service Advanced Configuration Snippet (Safety Valve) for hive-site.xml", add:

<property>
<name>hive.aux.jars.path</name>
<value>file:///opt/cloudera/aux_jars</value>
</property>

2. In the HiveServer2 Service Environment Advanced Configuration Snippet (Safety Valve), add:

HIVE_AUX_JARS_PATH=/opt/cloudera/aux_jars

Note that both settings should point to the directory containing the jar, not the jar file itself.

After saving the configuration, restart the HiveServer2 service and the UDF jar path should take effect.

如果我的文字帮到了您,那么可不可以请我喝罐可乐?