hive安装

tar -zxvf /opt/softwares/apache-hive-1.0.1-bin.tar.gz  -C /opt/modules/

mv apache-hive-1.0.1-bin /opt/modules/hive-1.0.1

vi /etc/profile
export HIVE_HOME=/opt/modules/hive-1.0.1
export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib
export PATH=$HIVE_HOME/bin:$PATH
export HIVE_CONF_DIR=$HIVE_HOME/conf

source /etc/profile

$HIVE_HOME/bin的hive-config.sh

export HIVE_HOME=/opt/modules/hive-1.0.1
export JAVA_HOME=/opt/modules/jdk1.7
export HADOOP_HOME=/opt/modules/hadoop-1.2.1

/opt/modules/hive-1.0.1/conf
cp hive-env.sh.template hive-env.sh
# HADOOP_HOME=${bin}/../../hadoop
HADOOP_HOME=/opt/modules/hadoop-1.2.1
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/opt/modules/hive-1.0.1/conf

cp hive-default.xml.template hive-site.xml


yum install mysql-server  cd /usr/local/mysql/
y
service mysqld start  select * from user;


cp /opt/software/mysql-connector-java-5.1.37-bin.jar  /opt/modules/hive-1.0.1/lib/


上传hive  lib  里面mysql-connect-jar   mysql 节点grant增加密码123456
grant all on *.* to root@'%' identified by '123456';
grant all on *.* to root@'hadoop-master.dragon.org' identified by '123456';
hive-site.xml
javax.jdo.option.ConnectionURL
jdbc:mysql://hadoop-master.dragon.org/hive?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
123456
<property>
    <name>system:java.io.tmpdir</name>
    <value>/opt/modules/hive-1.0.1/iotmp</value>
  </property>
<property>
    <name>system:user.name</name>
    <value>root</value>
  </property>
 hadoop fs -mkdir /tmp/hive
 hadoop fs -chmod 733 /tmp/hive
 hadoop fs -mkdir /user/hive
 hadoop fs -chmod 733 /user/hive


 hadoop hdfs-site.xml
 <property>
<name>fs.hdfs.impl.disable.cache</name>
<value>true</value>
</property>


HIVE常见的错误
修改hive数据库编码:mysql数据库的编码目前最好设置为latin1,否则使用hive会出现莫名其妙的问题 注意查看hive表也得是latin1
mysql> alter database hive character set latin1;
DEBUG命令:
hive -hiveconf hive.root.logger=DEBUG,console
启动
hive
show tables;
exit;


#启动metastore服务
#~ bin/hive --service metastore &
#启动hiveserver服务
#~ bin/hive --service hiveserver &
#启动hive客户端
#~ bin/hive shell



你可能感兴趣的:(hive,安装)