CDH hive的安装

时间:2022-10-20 23:22:26

tar zxvf 解压包

配置环境变量

export HIVE_HOME=/usr/local/soft/hive
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin

source生效

yum install -y mysql-server

service mysqld start (启动mysql 服务)

chkconfig mysqld on

yum install -y mysql-connector-java

cp /usr/share/java/mysql-connector-java-5.1.17.jar /usr/local/soft/hive/lib

进入mysql客户端  mysql

建表赋权限

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;

cd /hive/conf

mv hive-default.xml.template hive-site.xml

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://spark1:3306/hive_metadata?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>

vi /usr/local/hive/bin/hive-config.sh

mv hive-env.sh.template hive-env.sh

export JAVA_HOME=/usr/java/latest
export HIVE_HOME=/usr/local/soft/hive
export HADOOP_HOME=/usr/local/soft/hadoop