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

猜你喜欢

转载自blog.csdn.net/weixin_36104843/article/details/80368462
今日推荐