ubuntu安裝hive並配置WEB UI

一、安裝HA模式的hadoop集羣

    參考:https://blog.csdn.net/weixin_36104843/article/details/80211215

二、去官網下載對應的hive版本

    官網:https://mirrors.tuna.tsinghua.edu.cn/apache/hive/

    這裏用2.2的版本

    wget https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.2.0/apache-hive-2.2.0-bin.tar.gz

三、解壓並複製到/usr/local/hive下面

    tar -zxf apache-hive-2.2.0-bin.tar.gz

    mv  apache-hive-2.2.0-bin /usr/local/hive

四、配置環境變量

    nano /etc/profile

    export HIVE_HOME=/usr/local/hive
    export PATH=$HIVE_HOME/bin:$PATH

    source /etc/profile

五、Hive 配置 Hadoop HDFS

hadoop fs -mkdir -p /user/hive/warehouse  
hadoop fs -mkdir -p /user/hive/tmp  
hadoop fs -mkdir -p /user/hive/log  
hadoop fs -chmod -R 777 /user/hive/warehouse  
hadoop fs -chmod -R 777 /user/hive/tmp  
hadoop fs -chmod -R 777 /user/hive/log 
檢查目錄是否創建成功
hadoop fs -ls /user/hive
六、下載mysql的驅動並複製到hive/lib下面
mysql驅動
https://dev.mysql.com/downloads/connector/j/5.0.html

七、配置hive

    cd /usr/local/hive/conf


    1、.配置hive-site.xml文件, 將hive-default.xml.template文件拷貝爲hive-default.xml, 並編輯hive-site.xml文件(刪除所有內容,只留一個<configuration></configuration>)


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>


   <name>javax.jdo.option.ConnectionURL</name>


    <value>jdbc:mysql://192.168.56.1:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>


   <description>JDBC connect string for a JDBCmetastore</description>


 </property>


 <property>


   <name>javax.jdo.option.ConnectionDriverName</name>


    <value>com.mysql.jdbc.Driver</value>


   <description>Driver class name for a JDBCmetastore</description>


 </property>


 <property>


   <name>javax.jdo.option.ConnectionUserName</name>


   <value>root</value>


   <description>Username to use against metastoredatabase</description>


 </property>


 <property>


   <name>javax.jdo.option.ConnectionPassword</name>


   <value>root</value>


   <description>password to use against metastoredatabase</description>


 </property>


  <property>


   <name>hive.exec.local.scratchdir</name>


   <value>/usr/local/hive/tmp</value>


   <description>Local scratch space for Hive jobs</description>


 </property>


  <property>


   <name>hive.downloaded.resources.dir</name>


   <value>/usr/local/hive/tmp/resources</value>


   <description>Temporary local directory for added resources in theremote file system.</description>


 </property>


  <property>


   <name>hive.querylog.location</name>


   <value>/usr/local/hive/tmp/querylog</value>


   <description>Location of Hive run time structured logfile</description>


 </property>


  <property>


   <name>hive.server2.logging.operation.log.location</name>


   <value>/usr/local/hive/tmp/operation_logs</value>


    <description>Toplevel directory where operation logs are stored if logging functionality isenabled</description>

 </property>
 <property>
<name>hive.server2.webui.host</name>
<value>master01</value>
</property>
<property>
<name>hive.server2.webui.port</name>
<value>10002</value>
</property>
</configuration>


2、初始化數據庫
schematool -dbType mysql -initSchem
八、啓動hive
    啓動Metastore服務
    hiveserver2   hive --service  hiveserver2 2>&1 >> /dev/null &

驗證:訪問 http://master01:10002/


參考:

https://www.jianshu.com/p/40fc2414bc7f

https://www.cnblogs.com/xdlaoliu/p/7258222.html

https://blog.csdn.net/reesun/article/details/8556078

發佈了44 篇原創文章 · 獲贊 7 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章