1、hive下载
http://apache.opencas.org/hive/stable/apache-hive-1.2.1-bin.tar.gz
(安装hive时,保证hadoop已在本机正常运行着)
3、部署步骤
vim /etc/profile
export HIVE_HOME=/home/richmail/hive
export PATH=$HIVE_HOME/bin:$PATH
tar pache-hive-1.2.1-bin.tar.gz
ln -sf pache-hive-1.2.1-bin hive
cd hive/conf
vim hive-env.sh
HADOOP_HOME=/home/richmail/hadoop
export HIVE_CONF_DIR=/home/richmail/hive/conf
mkdir /home/richmail/hive/logs
vim hive-log4j.properties
hive.log.threshold=ALL
hive.root.logger=INFO,DRFA
hive.log.dir=/home/richmail/hive/logs
hive.log.file=hive.log
hdfs dfs -mkdir /home/richmail/hive/warehouse
hdfs dfs -chmod g+w /home/richmail/hive/warehouse
(默认目录是/user/hive/warehouse)
vim hive-site.xml
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.9.87:3306/hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>richmail</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>12345678</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/home/richmail/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://192.168.9.89:9083</value>
</property>
</configuration>
4、下载mysql连接工具,放在/home/richmail/hive/lib/下
cp mysql-connector-java-5.0.8-bin.jar /home/richmail/hive/lib/
5、连接数据库创建库hive
create database hive;
alter database hive character set latin1;
6、启动hive
hive --service metastore &
7、测试
连接数据库查看
至此hive已部署完成!
hive使用Mysql作为Hive metaStore的存储数据库
Hive的数据放在HDFS的warehouse目录下,一个表对应一个子目录