hive-0.12.0-cdh5.1.0安装

先前条件:

要先安装好MYSQL

下载:hive-0.12.0-cdh5.1.0.tar.gz,并解压到安装目录

1. 添加环境变量

修改/etc/profile文件。

#vi /etc/profile

增加

export HIVE_HOME=/hadoop/hadoop/hive

修改

exportPATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin:$HIVE_HOME/bin

保存退出

#source /etc/profile

2.修改conf目录下的模板文件

l  cd  $HIVE_HOME/conf

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

cp hive-env.sh.template hive-env.sh

cp hive-log4j.properties.template  hive-log4j.properties

2.1 修改hive-env.sh

# Set HADOOP_HOME to pointto a specific hadoop install directory
export  HADOOP_HOME=/usr/local/cdh/hadoop
 #HiveConfiguration Directory can be controlled by:
export  HIVE_CONF_DIR=/usr/local/cdh/hive/conf

2.2 修改hive-site.xml

<property>
 
 <name>javax.jdo.option.ConnectionURL</name>
 
 <value>jdbc:mysql://192.168.0.6:3306/hive?createDatabaseIfNotExist=true</value>
 
 <description>JDBC connect string for aJDBCmetastore</description>
 
</property>
 
 <property>
 
 <name>javax.jdo.option.ConnectionDriverName</name>
 
 <value>com.mysql.jdbc.Driver</value>
 
 <description>Driver class name for aJDBCmetastore</description>
 
</property>
 
<property>
 
 <name>javax.jdo.option.ConnectionUserName</name>
 
 <value>hive</value>
 
 <description>username to use againstmetastoredatabase</description>
 
</property>
 
<property>
 
 <name>javax.jdo.option.ConnectionPassword</name>
 
 <value>hive</value>
 
 <description>password to use againstmetastoredatabase</description>
 
</property>
 
<property>
 
 <name>hive.metastore.schema.verification</name>
 
 <value>false</value>
 
 <description>

3.安装mysql jdbc

hadoop@james-ubuntu32:~/tmp/tools$cp mysql-connector-java-5.1.28-bin.jar /usr/local/hive/lib


4.启动

1、启动hive:

Bin/hive

nohup hive --service hiveserver

    2、测试sql:

show tables;

create table shark_test01(id int, namestring);

select * from shark_test01;

exit;

    查看hive创建的文件:hadoop fs -ls -R /user/hive




版权声明:本文为博主原创文章,未经博主允许不得转载。

posted @ 2014-09-23 15:51  JamesFan  阅读(342)  评论(0编辑  收藏  举报