Hive 的安装部署和测试
2016-03-02 12:20
246 查看
Hive的安装
Hive安装需求
根据hive安装的需求:
hive1.2需求1.7+的jdk版本
hive0.14-1.1 需求1.6+的jdk版本
(preferred)hadoop2.0+的版本
Hive安装环境准备
jdk 1.7+版本准备hive安装包(可以去官网下载)
hadoop2.5版本
hive各版本下载地址
Hive的安装步骤
解压hive的文件安装包到指定文件夹
tar zxf apache-hive-0.13.1-bin.tar.gz -C opt/modules/修改Hive配置文件
重命名hive-env.sh.template文件为hive-env.sh修改文件内容
1> HADOOP_HOME=/opt/modules/hadoop-2.5.0 ##配置hadoop程序地址
2>export HIVE_CONF_DIR=/opt/modules/hive-0.13.1/conf ##hive程序conf的路径
创建数据的存储地址
根据官方网站介绍
在hdfs上创建指定的文件夹存放数据
进入hadoop目录
1>bin/hdfs dfs -mkdir /tmp 2>bin/hdfs dfs -mkdir /user/hive/warehouse 给定组读写的权限 3>bin/hdfs dfs -chmod g+w /tmp 4>bin/hdfs dfs -chmod g+w /user/hive/warehouse
启动hive程序
查看hive目录结构并进入启动hive:
bin/hive
简单操作hive,查看当前 库,表并创建测试表
MySql的安装
Hive本身自带一个数据库,但是有弊端,hive本身数据库,每次只允许一个用户登录安装需求,
1. 机器联网, 2. 检测mysql的下载地址
MySql安装步骤
检测本机mysql
yum list installed mysql* rpm -qa | grep mysql*
查看是否有mysql安装包
yum list mysql
安装mysql客户端:
yum install mysql
安装mysql 服务器端:
yum install mysql-server yum install mysql-devel
[root@bigdata00 /]# service mysqld start Initializing MySQL database: Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h bigdata00.hadoop-hao.com password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] Starting mysqld: [ OK ]
注意启动提示信息
修改MySql用户信息
修改root用户登录密码 /usr/bin/mysqladmin -u root password '123456' 修改本机登录的密码 /usr/bin/mysqladmin -u root -h bigdata00.hadoop-hao.com password '123456'
登录mysql
登录mysqlmysql -uroot -p
使用以下sql修改用户信息
设置mysql关联hive
修改配置文件
根据官方网站可以查看需要设置的基本属性
### 创建hive.site.xml文件
在hive/conf/目录下创建hive.site.xml文件
加载mysql驱动文件
将驱动文件解压到相关目录tar -zxf mysql-connector-java-5.1.27.tar.gz -C /opt/modules/
进入mysql驱动文件,复制驱动文件到hive
cp -r mysql-connector-java-5.1.27-bin.jar cd /opt/modules/hive-0.13.1/lib/
重新启动Hive
bin/hive
启动前:
启动后
通过mysql可以看到mysql自动创建了一个库
测试
创建数据库
create database db_hive_test;
创建测试表
create table student(id int,name string) row format delimited fields terminated by '\t';
加载数据到表中
load data local inpath ‘/opt/datafiles/student.txt’ into table default.student`查询表信息
select * from student;
查看表的详细信息
desc formatted student;
通过ui页面查看创建的数据位置
通过Mysql查看创建的表
查看hive的函数
show functions;
查看函数详细信息
desc function sum; desc function extended
相关文章推荐
- 推荐一个java开源项目 JeeSite
- 分享几套程序员入门教程,说不准有您需要的噢
- 使用dryrun直接运行github项目查看效果
- javascript高级程序设计笔记-第六章(面向对象编程)
- 深度学习研究组Deep Learning Research Groups
- 深度学习数据集Deep Learning Datasets
- 深度学习阅读列表 Deep Learning Reading List
- 开心的小明(ACM)
- Django~Databases
- 用最少的工具使用树莓派进行编程
- 最大似然估计Maximum Likelihood Estimation
- Expectation Maximization-EM(期望最大化)-算法以及源码
- 最大似然估计Maximum-likelihood (ML) Estimation
- IOS 3D Touch 开发教程
- java中mysql问题
- 运算符(二)
- Remove highlight from document(Aspose Word 删除高亮)
- 似然和对数似然Likelihood & LogLikelihood
- Maximum Likelihood Method极大似然估计的朴素理解
- spring 如何加载applicationContext.xml