设为首页 加入收藏

TOP

hive常用命令整理
2018-11-29 02:04:22 】 浏览:41
Tags: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
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Hive限制 下一篇Hive 表的复制

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目