CDH 中配置 Hive 的輔助 JAR 目錄

方法一
  1. 分別在 HiveServer2 和 WebHCat Server 所在的服務(wù)器上創(chuàng)建 /etc/hive/auxlib 目錄

    [root@cdh01 hive]# hostname
    cdh01.cnyimi.cn
    [root@cdh01 hive]# pwd
    /etc/hive
    [root@cdh01 hive]# ll
    總用量 0
    drwxr-xr-x 2 root root   6 6月  26 21:52 auxlib
    lrwxrwxrwx 1 root root  27 6月  26 21:56 conf -> /etc/alternatives/hive-conf
    drwxr-xr-x 2 root root 326 6月  26 21:56 conf.cloudera.hive
    
    image

    如果沒(méi)有在 HiveServer2 或 WebHCat Server 所在的服務(wù)器創(chuàng)建的該目錄,重啟時(shí)會(huì)報(bào)以下異常。

    ...
    + ERROR: HIVE_AUX_JARS_PATH is configured in Cloudera Manager as /etc/hive/auxlib. 
       However directory /etc/hive/auxlib does not exist. 
       When configured, directory specified in HIVE_AUX_JARS_PATH must be created and managed manually before starting Hive.
    ...
    
  2. Hive --> 配置 --> 搜索 jar

    /etc/hive/auxlib
    
    image
  3. Hive --> 配置 --> 搜索 hive-env.sh

    HIVE_AUX_JARS_PATH=/etc/hive/auxlib
    
    image
  4. 重啟 Hive

    image

    image

    image
方法二
  1. 分別在 HiveServer2 和 Hive Metastore Server 所在的服務(wù)器上創(chuàng)建 Jar 存放目錄

    [root@cdh01 lib]# pwd;ll
    /data/hive/lib
    總用量 84
    -rw-r--r-- 1 root root 82101 6月  27 20:53 json-serde-1.3.7-jar-with-dependencies.jar
    

    注意:
    如果 Hive Metastore 與 HiveServer2 不在同另一臺(tái)主機(jī)上,??那么要在這兩臺(tái)機(jī)器上創(chuàng)建相同的目錄,但是 JAR 文件需要上傳到 HiveServer2 主機(jī)上。

  2. Hive -> 配置 -> 搜索 hive-site.xml

    <property>
        <name>hive.reloadable.aux.jars.path</name>
        <value>/data/hive/lib</value>
        <description>Path to Hive UDF JAR files.</description>
    </property>
    
    image
  3. 部署客戶端配置,重啟 Hive。


    image

    image

    image

優(yōu)缺點(diǎn):

方法一方式設(shè)置 Hive CLI 和 Beeline 均適用,但是目錄位置必須為 /etc/hive/auxlib

方法二方式設(shè)置只對(duì) Beeline 適用,Hive CLI 方式無(wú)法識(shí)別 Jar 包,優(yōu)點(diǎn)在于目錄位置可以隨意指定,使用時(shí)需要執(zhí)行執(zhí)行 RELOAD 命令(好像要執(zhí)行兩次)即可加載到新增 Jar 包。

參考 CDH 官方文檔:

https://www.cloudera.com/documentation/enterprise/latest/topics/cm_mc_hive_udf.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • hive.ddl.output.format:hive的ddl語(yǔ)句的輸出格式,默認(rèn)是text,純文本,還有json...
    博弈史密斯閱讀 2,106評(píng)論 0 6
  • 說(shuō)明:不少讀者反饋,想使用開(kāi)源組件搭建Hadoop平臺(tái),然后再部署Kylin,但是遇到各種問(wèn)題。這里我為讀者部署一...
    大詩(shī)兄_zl閱讀 2,184評(píng)論 0 2
  • for my honey! 1、前言 安裝hive前提是要先安裝hadoop集群,并且hive只需要再hadoop...
    bigdata_er閱讀 6,012評(píng)論 3 5
  • Hive是什么 我們知道傳統(tǒng)數(shù)據(jù)存儲(chǔ)都是存儲(chǔ)在關(guān)系型數(shù)據(jù)庫(kù)中,它們使用一種SQL(結(jié)構(gòu)化查詢語(yǔ)言)方言來(lái)查詢數(shù)據(jù)庫(kù)...
    零度沸騰_yjz閱讀 1,200評(píng)論 0 7
  • 看到群友在群里的問(wèn)話,與同事相視大笑!我們兩都在感慨,似乎減肥和豐胸,女人永遠(yuǎn)都會(huì)有需求! 或許很多人都會(huì)用藥物,...
    jessica258130閱讀 411評(píng)論 0 0

友情鏈接更多精彩內(nèi)容