Spark集群搭建的Hive 0.13搭建完整版


一、安装hive包
1、将课程提供的apache-hive-0.13.1-bin.tar.gz使用WinSCP上传到spark1的/usr/local目录下。
2、解压缩hive安装包:tar -zxvf apache-hive-0.13.1-bin.tar.gz。
3、重命名hive目录:mv apache-hive-0.13.1-bin hive
4、配置hive相关的环境变量
vi .bashrc
export HIVE_HOME=/usr/local/hive
export PATH=$HIVE_HOME/bin
source .bashrc
二、安装mysql
1、在spark1上安装mysql。
2、使用yum安装mysql server。
yum install -y mysql-server
service mysqld start
chkconfig mysqld on
3、使用yum安装mysql connector
yum install -y mysql-connector-java
4、将mysql connector拷贝到hive的lib包中
cp /usr/share/java/mysql-connector-java-5.1.17.jar /usr/local/hive/lib
5、在mysql上创建hive元数据库,并对hive进行授权
create database if not exists hive_metadata;
grant all privileges on hive_metadata.* to 'hive'@'%' identified by 'hive';
grant all privileges on hive_metadata.* to 'hive'@'localhost' identified by 'hive';
grant all privileges on hive_metadata.* to 'hive'@'spark1' identified by 'hive';
flush privileges;
use hive_metadata;
三、配置hive-site.xml
mv hive-default.xml.template hive-site.xml
vi hive-site.xml

  javax.jdo.option.ConnectionURL
  jdbc:mysql://spark1:3306/hive_metadata?createDatabaseIfNotExist=true
  javax.jdo.option.ConnectionDriverName
  com.mysql.jdbc.Driver
  javax.jdo.option.ConnectionUserName
  hive
  javax.jdo.option.ConnectionPassword
  hive
  hive.metastore.warehouse.dir
  /user/hive/warehouse
四、配置hive-env.sh和hive-config.sh
mv hive-env.sh.template hive-env.sh

vi /usr/local/hive/bin/hive-config.sh
export JAVA_HOME=/usr/java/latest
export HIVE_HOME=/usr/local/hive
export HADOOP_HOME=/usr/local/hadoop

五、验证hive是否安装成功
直接输入hive命令,可以进入hive命令行

你可能感兴趣的:(Spark集群搭建的Hive 0.13搭建完整版)