HIVE:
my_cluster.sh start
(1-标准输出,2-错误输出,2>&1 : 表示将错误重定向到标准输出上,&: 放在命令结尾,表示后台运行)
nohup hive --service metastore 1>/opt/module/hive-3.1.2/logs/metastore.log 2>&1 &
nohup hive --service hiveserver2 1>/opt/module/hive-3.1.2/logs/hiveSercer2.log 2>&1 &
beeline -u jdbc:hive2://hadoop102:10000 -n atguigu ---退出命令 ----> !quit
停止所有的RunJar进程
jps | grep RunJar | awk '{print $1}' | xargs -n1 kill -9
hive启停脚本
-- hiveService.sh start
-- 等一会,再启动
-- beeline -u jdbc:hive2://hadoop102:10000 -n atguigu
-- hiveService.sh stop
将JSON格式转为以下形式,存在coll.txt文件中;
songsong,bingbing_lili,xiao song:18_xiaoxiao song:19,hui long guan_beijing
yangyang,caicai_susu,xiao yang:18_xiaoxiao yang:19,chao yang_beijing
create table collection(
name string ,
friends array<string>,
childrens map<string,int>,
address struct<street:string,city:string>
)
row format delimited fields terminated by ','
collection items terminated by '_'
map keys terminated by ':'
lines terminated by '\n';
数据存在coll.txt文件中
load data local inpath '/opt/module/hive-3.1.2/datas/coll.txt' into table collection;
加载数据 本地路径(存放的数据) 目标表
查询另一种方式:
struct-->address struct<street:string,city:string> ---> 查询时可以将strut的集合属性类比于java的对象
select name,friends[0],childrens['xiao song'],address.street from collection;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术