Hive与ES整合

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/hive.html

 

注:添加的第三方jar必须位于namenode下,否则依然找不到该jar包。或者直接添加到hdfs!!

 

安装

1.CLI方式:

  (1)将elasticsearch-hadoop jar放于Hive classpath中。在HIVE CLI下,使用ADD命令添加文件,jars或归档到classpath:

ADD JAR /path/elasticsearch-hadoop.jar;
 该命令需要可以在本地文件系统或远程找到的正确的URI。通常最好使用分布式文件系统(如HDFS或Amazon S3),并使用它,因为脚本可能在各种机器上执行。
 当使用JDBC / ODBC驱动程序时,ADD JAR命令不可用,并且将被忽略。因此,建议将该jar提供给Hive全局classpath中。
 
 (2)作为替代,可以使用命令行:
bin/hive --auxpath=/path/elasticsearch-hadoop.jar
 (3)或者使用通过命令行指定的hive.aux.jars.path属性:
$ bin/hive -hiveconf hive.aux.jars.path=/path/elasticsearch-hadoop.jar
 
2.HiveServer2方式
 
   修改hive-site.xml配置,可以通过hive.aux.jars.path选项注册更多的jar(也接受一个URI): 
<property>
  <name>hive.aux.jars.path</name>
  <value>/path/elasticsearch-hadoop.jar</value>
  <description>A comma separated list (with no spaces) of the jar files</description>
</property>
 
 注意:CDH版本,需要将jar包放到如下配置指定的路径,如配置为空可放置在任意路径
 该辅助路径下的文件,hive用户必须有读取权限

 

 
 
 
 
 
 
posted @ 2018-01-04 11:00  Mr.Ming2  阅读(2319)  评论(0编辑  收藏  举报