HIVE:将结构化的数据文件映射为数据库表
查询语句简便话,类SQL语言;
表在hdfs中表现为文件夹
准备工作(要先启动hadoop和zookeeper)
[root@hadoop151 hive]# jps
15105 Jps
7715 NodeManager
2855 QuorumPeerMain
7303 DataNode
7179 NameNode
7455 SecondaryNameNode
7599 ResourceManager
启动之后应该要有的程序
启动HIVE
[root@hadoop151 hive]# nohup hive --service hiveserver2 &
[root@hadoop151 hive]# hive //hive命令行
[root@hadoop151 hive]# beeline -u "jdbc:hive2://localhost:10000" //Beeline
上面两种启动的方式选其一即可,beeline里面显示表格有框
HIVE表里的基本数据类型
int
double
decimal
boolean
string //字符串
date
timestamp //时间戳
数据表
内部表
hdfs中为所属数据库目录下的子文件夹
删除表会删除数据
示例:
hive>create database myhive;
hive> use myhive;
hive> create table if not exists user(id