Hadoop-2.7.3环境下Hive-2.1.1安装配置。
来源:互联网 发布:道亨软件 编辑:程序博客网 时间:2024/06/01 08:23
环境:ubuntu-16.0.4;jdk1.8.0_111;apache-hadoop-2.7.3;apache-hive-2.1.1。
这里只记录Hive的安装。
首先从官网上下载所需要的版本,本人下载的apache-hive-2.1.1-bin.tar.gz。放到用户主目录下面。
(1)解压:
$tar -zxvf apache-hive-2.1.1-bin.tar.gz
(2)进入到conf目录:
$cd apache-hive-2.1.1-bin/bin/conf
$ls
会看到有下面这些文件:
beeline-log4j2.properties.template hive-exec-log4j2.properties.template llap-cli-log4j2.properties.template
hive-default.xml.template hive-log4j2.properties.template llap-daemon-log4j2.properties.template
hive-env.sh.template ivysettings.xml parquet-logging.properties
然后在conf路径下,执行以下几个命令
$cp hive-default.xml.template hive-default.xml
$cp hive-env.sh.template hive-env.sh
$cp hive-default.xml hive-site.xml
(3)添加mysql驱动:
下载mysql-connector-java-x.y.z-bin.jar文件并放到apache-hive-2.1.1-bin/lib目录下面。
(4)设置路径及环境变量:
$sudo mv apache-hive-2.1.1-bin /usr/local/
$sudo vim /etc/profile添加HIVE_HOME。
source /etc/profile
(5)修改hive-site.xml及hive-env.sh相关配置
将hive-site.xml文件中的内容修改为如下所示:
<?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://localhost:3306/hive?createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>123456</value> <description>password to use against metastore database</description> </property> </configuration>
将hive-env.sh文件修改为如下所示:
# Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# Set Hive and Hadoop environment variables here. These variables can be used# to control the execution of Hive. It should be used by admins to configure# the Hive installation (so that users do not have to set environment variables# or set command line parameters to get correct behavior).## The hive service being invoked (CLI/HWI etc.) is available via the environment# variable SERVICE# Hive Client memory usage can be an issue if a large number of clients# are running at the same time. The flags below have been useful in # reducing memory usage:## if [ "$SERVICE" = "cli" ]; then# if [ -z "$DEBUG" ]; then# export HADOOP_OPTS="$HADOOP_OPTS -XX:NewRatio=12 -Xms10m -XX:MaxHeapFreeRatio=40 -XX:MinHeapFreeRatio=15 -XX:+UseParNewGC -XX:-UseGCOverheadLimit"# else# export HADOOP_OPTS="$HADOOP_OPTS -XX:NewRatio=12 -Xms10m -XX:MaxHeapFreeRatio=40 -XX:MinHeapFreeRatio=15 -XX:-UseGCOverheadLimit"# fi# fi# The heap size of the jvm stared by hive shell script can be controlled via:## export HADOOP_HEAPSIZE=1024 export HADOOP_HEAPSIZE=1024## Larger heap size may be required when running queries over large number of files or partitions. # By default hive shell scripts use a heap size of 256 (MB). Larger heap size would also be # appropriate for hive server (hwi etc).# Set HADOOP_HOME to point to a specific hadoop install directory# HADOOP_HOME=${bin}/../../hadoop HADOOP_HOME=/usr/local/hadoop #这里设置成自己的hadoop路径# Hive Configuration Directory can be controlled by:# export HIVE_CONF_DIR= export HIVE_CONF_DIR=/usr/local/apache-hive-2.1.1-bin/conf# Folder containing extra ibraries required for hive compilation/execution can be controlled by:# export HIVE_AUX_JARS_PATH=export HIVE_AUX_JARS_PATH=/usr/local/apache-hive-2.1.1-bin/lib
(6)在mysql里创建hive用户,并赋予其足够权限
1.$mysql -u root -p
2.mysql> create user 'hive' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'hive' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
(7)设置元数据库
$schematool -initSchema -dbType mysql
如果hive的元数据库是本地环境下,至此就完成了安装。
如果hive的元数据库是远程环境下,在服务端主机上执行完第5步的时候,然后将apache-hive-2.1.1-bin文件夹拷贝到客户端上。同时,将服务端中hive-site.xml中URL地址的localhost改成服务端的ip地址。
并将客户端的hive-site.xml文件中的内容修改为如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration> <property> <name>hive.metastore.uris</name> <value>thrift://服务端ip地址:9083</value> </property> </configuration>
这个时候,客户端需要启动metastore服务:
$hive --service metastore &
如果一直没反应,按回车,可以使用jobs命令查看是否启动成功
启动成功后,就可以执行hive命令。
- Hadoop-2.7.3环境下Hive-2.1.1安装配置。
- Hadoop&hive安装配置
- hadoop-hive安装配置
- Hive&hadoop 安装配置
- Hadoop+Hive安装配置
- Linux下安装hive环境之1——ubuntu环境下安装配置jdk
- CentOS7基于Hadoop 2.7.3安装Hive 2.1.1
- CentOS7基于Hadoop 2.7.3安装Hive 2.1.1
- hadoop之hive环境安装
- 在伪分布hadoop-1.2.1环境下配置hive-0.12.0
- Hadoop 2.7.1在centos 6.3下配置变量环境并安装配置伪分布式集群
- Hadoop(1) : Linux下安装Java环境配置步骤详述
- hadoop-2.6.0下hive-1.2.2安装与配置
- hadoop环境配置3--hadoop安装测试
- hadoop-2.7.3 + hive-2.3.0 + zookeeper-3.4.8 + hbase-1.3.1 完全分布式安装配置
- hadoop-2.7.3 + hive-2.3.0 + zookeeper-3.4.8 + hbase-1.3.1 完全分布式安装配置
- Hadoop+Hive部署安装配置
- Hadoop+Hive部署安装配置
- easyUI验证表单两次密码是否相同
- Monash Bridging Course
- spring的DI/IOC机制
- delphi RestClient 用法1
- linux 误删除Oracle数据文件恢复
- Hadoop-2.7.3环境下Hive-2.1.1安装配置。
- 数据排序
- 计161_Problem : 字符串操作一(串)
- 使用kaptcha生成验证码
- logstash5.x 启动异常
- oracle分页的两种方式
- Tomcat安装与部署
- 使用eClipse将java源码打包成jar包
- 丢手帕问题 (约瑟夫问题)