1、安装Mysql
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
service mysqld restart
授权用户
GRANT ALL PRIVILEGES ON . TO 'hive'@'%' IDENTIFIED BY '****';
FLUSH PRIVILEGES;
2、配置系统环境变量
export JAVA_HOME=/usr/jdk1.8.0_101
export HADOOP_HOME=/usr/hadoop-2.7.2
export HIVE_HOME=/usr/hive
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:$HIVE_HOME/bin
3、配置hive
下载hive
wget http://apache.fayea.com/hive/hive-2.1.0/apache-hive-2.1.0-bin.tar.gz
配置conf/hive-env.sh
HADOOP_HOME=/usr/hadoop-2.7.2
export HIVE_CONF_DIR=/usr/hive/conf
配置conf/hive-site.xml
cp hive-default.xml.template hive-site.xml
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>Username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>****</value>
<description>password to use against metastore database</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.ConnectionURL</name>
<value>jdbc:mysql://192.168.31.247:3306/hive?createDatabaseIfNotExist=true</value>
</property>
4、下载mysql-connector-java-5.1.39-bin.jar放入/lib
5、运行服务
bin/hive --service metastore &
bin/hive --service hiveserver &
6、运行hive
7、在mysql数据库验证