hive常用命令整理

// hive常用命令整理---coco


1. 开启行转列功能之后:
set hive.cli.print.header=true; // 打印列名
set hive.cli.print.row.to.vertical=true; // 开启行转列功能, 前提必须开启打印列名功能
set hive.cli.print.row.to.vertical.num=1; // 设置每行显示的列数


2.使用过程中出错采用:
hive -hiveconf hive.root.logger=DEBUG,console   //重启调试。


3. hive的三种启动方式区别:
  1,hive  命令行模式,直接输入/hive/bin/hive的执行程序,或者输入 hive –service cli
     用于linux平台命令行查询,查询语句基本跟mysql查询语句类似
  2,hive  web界面的启动方式,hive –service hwi  
     用于通过浏览器来访问hive,感觉没多大用途
  3,hive  远程服务 (端口号10000) 启动方式,nohup hive –service hiveserver  & 
     用java等程序实现通过jdbc等驱动的访问hive就用这种起动方式了,这个是程序员最需要的方式了
 启动hive service :$HIVE_HOME/bin/hive --service hiveserver 10001 >/dev/null 2>/dev/null &
 
4. hive插入的2中方式:
基本的插入语法:
INSERT OVERWRITE TABLE tablename [PARTITON(partcol1=val1,partclo2=val2)]select_statement FROM from_statement
insert overwrite table test_insert select * from test_table;
对多个表进行插入操作:
FROM fromstatte
INSERT OVERWRITE TABLE tablename1 [PARTITON(partcol1=val1,partclo2=val2)]select_statement1
INSERT OVERWRITE TABLE tablename2 [PARTITON(partcol1=val1,partclo2=val2)]select_statement2


5.添加metastore启动脚本bin/hive-metastore.sh
#!/bin/sh
nohup ./hive --service metastore >> metastore.log 2>&1 &
echo $! > hive-metastore.pid


添加hive server启动脚本bin/hive-server.sh
nohup ./hive --service hiveserver >> hiveserver.log 2>&1 &
echo $! > hive-server.pid


启动metastore和hive server
./hive-metastore.sh
./hive-server.sh
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wulantian

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值