HIVE的安装

1.下载hive-0.12.0.tar.gz,解压,建符号链接hive到hive-0.12.0
2.在mysql中创建一个hive的database
3.把hive/conf/下的hive-default.xml.template改成hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://hivemaster/hive?characterEncoding=UTF-8</value>
<description>JDBC connect string for a JDBC metastore</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.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>xxxx</value>
<description>password to use against metastore database</description>
</property>
4.安装libmysql-java
把/var/cache/apt/archives/libmysql-java_5.1.16-2_all.deb拷贝过来
dpkg-deb –fsys-tarfile libmysql-java_5.1.16-2_all.deb |tar xvf -
把解压出来的
mysql-connector-java.jar 拷贝到hive/lib下
运行
hive
看/tmp/hadoop/hive.log里的报错日志,是否出错。
需要追查一下原因。
需要在hive-site.xml中把metastore的schema检查去掉。
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
<description>
Enforce metastore schema version consistency.
True: Verify that version information stored in metastore matches with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn’t match with one from in Hive jars.
</description>
</property>

5.在hdfs上建相关的目录
/user/hive/warehouse/

6.简单的使用:
t_hive.txt
16 2 3
61 12 13
41 2 31
17 21 3
71 2 31
1 12 34
11 2 34
注意中间用\t分隔
create table t_hive(a int, b int, c int) row format delimited fields terminated by ‘\t’;
创建表
load data local inpath ‘/home/hadoop/hive_soft/t_hive.txt’ overwrite into table t_hive;
加载数据
show tables;
显示表的内容
select * from t_hive;
显示表中的所有的内容

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值