作者:上午劳动_951 | 来源:互联网 | 2023-05-18 05:02
一、准备上传apache-hive-1.2.1.tar.gz和mysql--connector-java-5.1.6-bin.jar到node01cdtoolstar-z
一、准备
上传apache-hive-1.2.1.tar.gz和mysql--connector-java-5.1.6-bin.jar到node01
cd /tools
tar -zxvf apache-hive-1.2.1.tar.gz -C /ren/
cd /ren
mv apache-hive-1.2.1 hive-1.2.1
本集群采用mysql作为hive的元数据存储
vi etc/profile
export HIVE_HOME=/ren/hive-1.2.1
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile
二、安装mysql
yum -y install mysql mysql-server mysql-devel
创建hive数据库 create database hive
创建hive用户 grant all privileges on hive.* to hive@node01 identified by '123456';
grant all privileges on hive.* to hive@'%' identified by '123456';
三、hive安装
cd /ren/hive-1.2.1/conf
cp /root/mysql--connector-java-5.1.6-bin.jar /ren/hive-1.2.1/lib/
mv hive-default-xml.template hive-site.xml
vi hive-site.xml
修改
hive.exec.scratchdir
/ren/hive-1.2.1/data
hive.exec.local.scratchdir
/ren/hive-1.2.1/data/tmp
hive.downloaded.resources.dir
/ren/hive-1.2.1/data/${hive.session.id}_resources
javax.jdo.option.ConnectionURL
jdbc:mysql://node01:3306/hive
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
hive
javax.jdo.option.ConnectionPassword
123456
hive.metastore.warehouse.dir
/ren/hive-1.2.1/warehouse
hive.querylog.location
/ren/hive-1.2.1/data/log
同步 scp -r /ren/hive-1.2.1 root@node02:/ren
scp -r /ren/hive-1.2.1 root@node03:/ren
启动hive hive
启动hiveserver hive --service hiveserver2
启动metastore hive --service metastore
四、spark-sql
cd /ren/spark-2.02/conf
加入文件hive-site.xml
内容
hive.metastore.uris
thrift://node01:9083
启动 :spark-sql(需要先启动hive的metastore)