
您好,很高兴为您解答。
1、hive-site.xml配置
<property><name>hive.hwi.war.file</name>
<value>lib/hive-hwi-0.10.0-cdh4.3.0.war</value>
<description>This sets the path to the HWI war file, relative to ${HIVE_HOME}.
</description>
</property>
<property>
<name>hive.hwi.listen.host</name>
<value>0.0.0.0</value>
<description>This is the host address the Hive Web Interface will listen
on</description>
</property>
<property>
<name>hive.hwi.listen.port</name>
<value>9999</value>
<description>This is the port the Hive Web Interface will listen on</description>
</property>
2、添加jar
将一下jar包添加到hive的lib下面
jasper-compiler-5.5.23.jar
jasper-runtime-5.5.23.jar
ant.jar
ant-launcher-1.8.2.jar
tools.jar(jdk的lib包下面的jar包)
3、启动hwi服务
nohup bin/hive --service hwi > /dev/null 2> /dev/null &
4、访问界面
http://172.21.1.56:9999/hwi
如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,望采纳!
~ O(∩_∩)O~
package com.example.hive.udfimport org.apache.hadoop.hive.ql.exec.UDF
import org.apache.hadoop.io.Text
public final class LowerCase extends UDF {
public Text evaluate(final Text s) {
if (s == null) { return null}
return new Text(s.toString().toLowerCase())
}
}
2、用eclipse下的fatjar插件进行打包
先下载net.sf.fjep.fatjar_0.0.31.jar插件包,cp至eclipse/plugins目录下,重启eclipse,右击项目选Export,选择用fatjar导出(可以删掉没用的包,不然导出的jar包很大)
3、将导出的hiveudf.jar复制到hdfs上
hadoop fs -copyFromLocal hiveudf.jar hiveudf.jar
4、进入hive,添加jar,
add jar hdfs://localhost:9000/user/root/hiveudf.jar
5、创建一个临时函数
如何上传?1,你想要在项目里面添加mysql的包,你可以在pom.xml文件下的<dependencies>标签下添加以下代码:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
然后,更新maven就可以了,记得要勾选force update
2,如果你说的上传到文件夹下,直接粘贴复制就行了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)