当前位置:   article > 正文

Hive的安装配置_property.hive.log.level

property.hive.log.level

操作系统centOS 6.5

Hadoop版本:hadoop 2.7.6

JDK版本:JDK 1.8.0

mysql版本:mysql 5.7

 

一、安装准备

1. 从官网下载解压hive的bin压缩文件 , 此处使用的是hive-2.1.1版本

2. 通过ftp传输到linux系统,使用tar -xzvf apache-hive-2.1.1-bin.tar.gz解压缩。

 

二、嵌入式模式的安装配置

1.  进入hive解压缩后的文件bin目录,执行./hive会自动创建derby数据库保存元信息。并进入hive命令行模式

2. 执行quit;命令退出,发现bin目录下多了保存元数据的文件。说明嵌入式模式已完成安装。

3. HIVE_HOME的配置:修改配置文件/etc/profile加入HIVE_HOME到系统path;执行source /etc/profile使配置立即生效。

export HIVE_HOME=/usr/local/hive

export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin

 

三、远程模式

1. 在windows上也解压hive的源安装文件。

2. 在mysql官网下载mysql-connector-java-5.1.46.tar.gzwen在文件,解压缩后,将其中的mysql-connector-java-8.0.12.jar文件上传到Linux系统中的/hive/lib/目录下。

3. 相关文件配置

(1)hive-env.sh

  1. export JAVA_HOME=/usr/local/jdk1.8.0
  2. export HADOOP_HOME=/usr/local/hadoop-2.7.6
  3. export HIVE_HOME=/usr/local/hive-2.1.1
  4. export HIVE_CONF_DIR=${HIVE_HOME}/conf
  5. export HIVE_AUX_JARS_PATH=${HIVE_HOME}/lib

(2) hive-log4j2.properties

执行cp hive-log4j2.properties.template hive-log4j2.properties

修改hive-log4j2.properties中的以下配置

  1. property.hive.log.level = INFO
  2. property.hive.root.logger = DRFA
  3. property.hive.log.dir = /user/hive/log
  4. property.hive.log.file = hive.log
  5. property.hive.perflogger.log.level = INFO

(3) hive-site.xml

在/hive/conf目录下创建hive-site.xml文件,配置以下信息.

   其中***.***.***.***是本地windows主机的ip,3306是mysql默认的port.

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. --><configuration>
  16. <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
  17. <!-- WARNING!!! Any changes you make to this file will be ignored by Hive. -->
  18. <!-- WARNING!!! You must make your changes in hive-site.xml instead. -->
  19. <!-- Hive Execution Parameters -->
  20. <!-- 设置 hive仓库的HDFS上的位置 -->
  21. <property>
  22. <name>hive.exec.scratchdir</name>
  23. <value>/user/hive/tmp</value>
  24. </property>
  25. <!--资源临时文件存放位置 -->
  26. <property>
  27. <name>hive.metastore.warehouse.dir</name>
  28. <value>/user/hive/warehouse</value>
  29. </property>
  30. <!-- 设置日志位置 -->
  31. <property>
  32. <name>hive.querylog.location</name>
  33. <value>/user/hive/log</value>
  34. </property>
  35. <property>
  36. <name>javax.jdo.option.ConnectionURL</name>
  37. <value>jdbc:mysql://192.168.***.***:3306/hive? createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;allowPublicKeyRetrieval=true</value>
  38. </property>
  39. <property>
  40. <name>javax.jdo.option.ConnectionDriverName</name>
  41. <value>com.mysql.jdbc.Driver</value>
  42. </property>
  43. <property>
  44. <name>javax.jdo.option.ConnectionUserName</name>
  45. <value>hive</value>
  46. </property>
  47. <property>
  48. <name>javax.jdo.option.ConnectionPassword</name>
  49. <value>zzwzyt</value>
  50. </property>
  51. <property>
  52. <name>hive.metastore.schema.verification</name>
  53. <value>false</value>
  54. </property>
  55. <property>
  56. <name>hive.exec.reducers.bytes.per.reducer</name>
  57. <value>256000000</value>
  58. <description>size per reducer.The default is 256Mb, i.e if the input size is 1G, it will use 4 reducers.</description>
  59. </property>
  60. <property>
  61. <name>hive.exec.reducers.max</name>
  62. <value>999</value>
  63. <description>
  64. max number of reducers will be used. If the one specified in the configuration parameter mapred.reduce.tasks is
  65. negative, Hive will use this one as the max number of reducers when automatically determine number of reducers.
  66. </description>
  67. </property>
  68. </configuration>

4. 复制 mysql-connector-java-5.1.46.jar 到hive的lib文件夹下

5. 设置hive账户支持远程登录

进入mysql命令行,执行update user set host='%' where user='hive';

再执行flush privileges; 使修改生效。

6. 在linux上执行hive命令,再quit;退出。发现mysql的hive数据库下多了很多保存元信息的表,说明远程模式安装配置成功。

6. 在hive命令行创建一个测试表格create test3,即可在mysql中查到相关元信息。

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/507920
推荐阅读
相关标签
  

闽ICP备14008679号