博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hive 环境配置 详解
阅读量:2393 次
发布时间:2019-05-10

本文共 1669 字,大约阅读时间需要 5 分钟。

1、由于hive依赖于Hadoop框架,所以首先启动Hadoop相关守护进程
注 : 需要先安装 Hadoop
-> namenode
$ sbin/hadoop-daemon.sh start namenode
-> datanode
$ sbin/hadoop-daemon.sh start datanode
-> Resourcemanager
$ sbin/yarn-daemon.sh start resourcemanager
-> nodemanager
$ sbin/yarn-daemon.sh start nodemanager
-> historyserver
$ sbin/mr-jobhistory-daemon.sh start historyserver
2、上传hive安装包到系统,在解压安装包
$ tar -zxf apache-hive-0.13.1-bin.tar.gz -C /opt/modules/
$ cd /opt/modules/hive-0.13.1-bin
// 此处的 Hive 文件已被重命名
3、在HDFS上创建对应的目录,并赋予权限
$ cd /opt/modules/hadoop-2.5.0
$ bin/hdfs dfs -mkdir /tmp
$ bin/hdfs dfs -mkdir -p /user/hive/warehouse
$ bin/hdfs dfs -chmod g+w /tmp
$ bin/hdfs dfs -chmod g+w /user/hive/warehouse
注: hadoop fs 在 Hadoop1.x 系列版本中使用的命令
metadata -> 元数据
表和数据的关联 -> 都需要存储
数据库和表
元数据默认存储在 -> Derby数据库
一般公司都存储在关系型数据库中: mysql oracle
/user/hive/warehouse -> 数据仓库目录 -> 保存 hive所有的数据
4、.template代表不启用,不生效的文件
$ cd /opt/modules/hive-0.13.1-bin
$ cd conf/
$ ls
5、hive-default.xml 包含了 hive所有的配置项,hive.metastore.warehouse.dir代表hive在HDFS上的默认目录路径
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
6、修改 hive-env.sh.template,将template去掉
1> 指定 Hadoop 的工作目录路径
HADOOP_HOME=/opt/modules/hadoop-2.5.0
2> 指定用户自定义文件的所在目录路径:
export HIVE_CONF_DIR=/opt/modules/hive-0.13.1-bin/conf
7、启动hive
$ cd /opt/modules/hive-0.13.1-bin
$ bin/hive
hive提供了一个可以交互的shell命令行
8、创建一张表
create table student(
num int,
name string
) row format delimited fields terminated by'\t';
注: hive 的命令行中不允许出 Tab键
-> 需要指定分隔符,让数据文件与表的结构对应
->创建一个测试文件
-> 加载数据
load data local inpath '/opt/datas/student.txt' into table student;
你可能感兴趣的文章
Build self-healing distributed systems with Spring Cloud
查看>>
如何利用Spring Cloud构建起自我修复型分布式系统
查看>>
Java代码实现设置系统时间
查看>>
java -D参数简化加入多个jar
查看>>
用Erlang开发的文档数据库系统CouchDB
查看>>
Apache Commons工具集简介
查看>>
Apache Cayenne—辣椒你吃了吗?
查看>>
云应用开发工具:Spring Cloud 1.0 正式发布
查看>>
[转]在VC中使用智能指针操作Excel
查看>>
关于Linux命令行环境下无线网卡的配置
查看>>
C++的朋友,你都在用什么连数据库啊
查看>>
Setup Kubernetes on a Raspberry Pi Cluster easily the official way!
查看>>
Installing Kubernetes on Linux with kubeadm
查看>>
k8s-Building Large Clusters
查看>>
[转]stl 通用排序算法解析
查看>>
分布式存储系统GlusterFS初体验
查看>>
GlusterFS常用命令小结
查看>>
GlusterFS分布式文件系统使用简介
查看>>
Use Docker Engine plugins
查看>>
Using Gluster for a Distributed Docker Storage Volume
查看>>