hive的安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hive的安装相关的知识,希望对你有一定的参考价值。
1.环境准备
hadoop环境
mysql环境
2.下载hive
http://apache.fayea.com/hive/
3.解压包
tar zxvf apache-hive-2.0.0-bin.tar.gz
4.安装hive
mv apache-hive-2.0.0-bin /usr/
5.设置环境变量
vim /etc/profile
export HIVE_HOME=/usr/apache-hive-2.0.0-bin
export PATH=PATH:HIVE_HOME/bin
source /etc/profile
6.修改hive-site.xml
cd /usr/apache-hive-2.0.0-bin/conf
cp hive-default.xml.template hive-site.xml
cp hive-log4j2.properties.template hive-log4j2.properties
编辑配置文件
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://10.2.10.254: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>user</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>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>datanucleus.readOnlyDatastore</name>
<value>false</value>
</property>
<property>
<name>datanucleus.fixedDatastore</name>
<value>false</value>
</property>
<property>
<name>datanucleus.autoCreateSchema</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoCreateTables</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoCreateColumns</name>
<value>true</value>
</property>
7.在hdfs上创建目录
cd /usr/hadoop/bin
hdfs dfs -mkdir -p /tmp
hdfs dfs -mkdir -p /user/hive/warehouse
hdfs dfs -chmod g+w /tmp
hdfs dfs -chmod g+w /user/hive/warehouse
8.在mysql中创建数据库
CREATE DATABASE hive;
GRANT ALL PRIVILEGES ON *.* TO user@% IDENTIFIED BY 123456 WITH GRANT OPTION;
ALTER DATABASE hive CHARACTER SET latin1;
9.手动上传mysql的jdbc库到hive/lib
mysql-connector-java-5.1.38-bin.jar
10.启动hive(也可以使用 ./hive)
cd /usr/apache-hive-2.0.0-bin
启动metastore服务
bin/hive --service metastore &
启动hiveserver服务
bin/hive --service hiveserver2 &
启动hive客户端
bin/hive shell
11.查看mysql元数据是否已经初始化
好了,至此hive已经安装成功了。
以上是关于hive的安装的主要内容,如果未能解决你的问题,请参考以下文章