下载Hive安装包
http://hive.apache.org/downloads.html
根据需求下载相应的安装包解压安装
默认的数据存放路径hdfs:/user/hive/warehouse/user
Hive配置文件主要从默认模版创建hive-site.xml和hive-env.sh
cp hive-default.xml.template hive-site.xml
cp hive-env.sh.template hive-env.sh
hive-site.xml修改以下属性
<property>
<name>javax.jdo.option.ConnectionURL
</name>
<value>jdbc:mysql://Master:3306/hive
</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName
</name>
<value>com.mysql.jdbc.Driver
</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword
</name>
<value>hive
</value>
</property>
<property>
<name>hive.hwi.listen.port
</name>
<value>9999
</value>
<description>This is the port the Hive Web Interface will listen on
</descript ion>
</property>
<property>
<name>datanucleus.autoCreateSchema
</name>
<value>false
</value>
</property>
<property>
<name>datanucleus.fixedDatastore
</name>
<value>true
</value>
</property>
<property>
<name>hive.metastore.local
</name>
<value>true
</value>
<description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM
</description>
</property>
配置Hive的配置文件路径
export HIVE_CONF_DIR= .../hive/conf
配置Hadoop的安装路径
HADOOP_HOME= .../hadoop
MySQL数据库安装
sudo apt-get install mysql-server
建立数据库hive
create database hive
创建hive用户,并授权
grant all on hive.* to hive@'%' identified by 'hive';
flush privileges;
#hive
hive>create table test(key string);
show tables;