您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 临沂分类信息网,免费分类信息发布

Hive两种模式安装

2024/6/20 19:29:49发布5次查看
hive两种模式安装 数据仓库工具,可以把hadoop下的原始结构化数据变成hive中的表。 支持一种与sql几乎完全相同的语言hiveql,除了不支持更新、索引和事务。 可以看成是从sql到map-reduce的映射器。 提供shell、jdbc/odbc、thrift、web等接口。 一、内嵌模式
hive两种模式安装
数据仓库工具,可以把hadoop下的原始结构化数据变成hive中的表。
支持一种与sql几乎完全相同的语言hiveql,除了不支持更新、索引和事务。
可以看成是从sql到map-reduce的映射器。
提供shell、jdbc/odbc、thrift、web等接口。
一、内嵌模式安装
这样安装的元数据保持在内嵌的derby数据库中,只能允许一个会话连接,只适用于简单的测试。
1、解压hive
[coder@h1 ~]$ tar -zxvf hive-0.10.0.tar.gz
2、配置环境变量/etc/profile
加入hive的安装目录,并把hive的bin目录配置到path
hive_home=/home/coder/hive-0.10.0
path=$hadoop_install/bin:$pig_install/bin:$java_home/bin:$hive_home/bin:$path
执行 source /etc/profile命令,使得配置生效
3、新建hive所需目录
在hdfs上建立/tmp和/user/hive/warehouse目录,并赋予组用户写权限。这是hive默认的数据文件存放目录,可以在hive-site.xml文件中配置。
[coder@h1 hadoop-0.20.2]$ bin/hadoop fs -mkdir /tmp
[coder@h1 hadoop-0.20.2]$ bin/hadoop fs -mkdir /user/hive/warehouse
[coder@h1 hadoop-0.20.2]$ bin/hadoop fs -chmod g+w /tmp
[coder@h1 hadoop-0.20.2]$ bin/hadoop fs -chmod g+w /user/hive/warehouse
4、输入hive命令,出现类似下面的内容,说明安装成功。
[coder@h1 hadoop-0.20.2]$ hive
logging initialized using configuration in jar:file:/home/coder/hive-0.10.0/lib/hive-common-0.10.0.jar!/hive-log4j.properties
hive history file=/tmp/coder/hive_job_log_coder_201305072118_1272944282.txt
hive> 
hive> show tables;
ok
time taken: 24.479 seconds
hive> exit;
二、独立模式安装
支持多用户会话,需要一个独立的元数据库,常用的是使用mysql作为元数据库。
1、启动mysql
[root@h1 ~]# service mysqld start
starting mysqld:  [  ok  ]
[root@h1 ~]# 
2、为hive建立相应的mysql账号
[root@h1 ~]# mysql
welcome to the mysql monitor.  commands end with ; or \g.
your mysql connection id is 2
server version: 5.1.66 source distribution
copyright (c) 2000, 2012, oracle and/or its affiliates. all rights reserved.
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql> create user 'hive' identified by '123456';
query ok, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'hive'@'localhost' identified by '123456' with grant option; 
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql> exit
bye
[root@h1 ~]#
然后从客户端用hive账号登陆mysql
3、建立hive专用元数据库
mysql>create database hive;
4、配置hive
在hive安装目录的conf目录下,将hive-default.xml.template复制一份命名为:hive-site.xml
修改以下内容,配置上mysql数据连接、驱动、用户名和密码
javax.jdo.option.connectionurl
   jdbc:mysql://localhost:3306/hive?createdatabaseifnotexist=true
javax.jdo.option.connectiondrivername
   com.mysql.jdbc.driver
javax.jdo.option.connectionusername
   hive
javax.jdo.option.connectionpassword
   123456
5、把mysql的驱动包拷贝到hive安装路径下的lib目录
6、进入hive,没报错说明独立模式安装成功
[coder@h1 ~]$ hive
logging initialized using configuration in jar:file:/home/coder/hive-0.10.0/lib/hive-common-0.10.0.jar!/hive-log4j.properties
hive history file=/tmp/coder/hive_job_log_coder_201305072212_717503278.txt
hive> show tables;
ok
time taken: 24.783 seconds
hive> exit;
临沂分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录