hive安装,
su - hadoop
xftp打开/home/hadoop/soft
上传
tar -xvf apache-hive-1.2.2-bin.tar.gz
mv apache-hive-1.2.2-bin …/install/hive
cd /home/hadoop/install/hive
修改环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export HADOOP_HOME=/home/hadoop/install/hadoop-2.7.4
export MYSQL_HOME=/usr/local/mysql
export HIVE_HOME=/home/hadoop/install/hive
export PS1="[\u@\h \w]$"
export PATH=JAVA_HOME/bin:HADOOP_HOME/sbin:HIVE_HOME/bin
source /etc/profile
HIVE存放元数据(将HDFS文件,映射为HIVE里面的表结构定义信息—>元数据信息)
数据是存储在HDFS上的
但是元数据信息derby mysql
HIVE—>MYSQL需要JDBC的支持,我们需要把JDBC包拷贝到hive/lib目录下
cp /home/hadoop/soft/mysql-connector-java-5.1.38.jar /home/hadoop/install/hive/lib
MySQL赋权操作
create database hive default character set latin1;
grant all on . to ‘hive’@’%’ identified by ‘hive’;
flush privileges;
mysql> create database hive default character set latin1;
Query OK, 1 row affected (0.04 sec)
mysql> grant all on . to ‘hive’@’%’ identified by ‘hive’;
Query OK, 0 rows affected (0.04 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
mysql> select user,host,password from mysql.user;
±-----±----------±------------------------------------------+
| user | host | password |
±-----±----------±------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| root | % | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| hive | % | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
±-----±----------±------------------------------------------+
3 rows in set (0.00 sec)
默认模板文件
hive-default.xml.template
vim /home/hadoop/install/hive/conf/hive-site.xml
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>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.
–>
======================================================================
source /etc/profile