Hive Cli<转>
来源:互联网 发布:mysql root空密码登录 编辑:程序博客网 时间:2024/05/17 22:52
Hive Cli
= hive启动 =
*$ hive –f script.q
*$ hive -e 'SELECT * FROM dummy‘
*$ hive -S -e 'SELECT * FROM dummy‘
*$ hive -hiveconf hive.root.logger=DEBUG,console
= set =
*hive> SET hive.enforce.bucketing=true; //设置值
*hive> SET hive.enforce.bucketing; // 显示值
*hive> set -v; //显示所有的值,包括hadoop的。
*hive> set; //显示跟基本的hadoop不同的配置,原理就是比对当前的所有选项与基本的配置是否不同,如修改过,已经不同了就打印该值。
= dfs 命令 =
dfs 命令可以执行 Shell 环境下的 hadoop fs 的所有命令
例如:
列出 HDFS 上的文件:
hive> dfs -ls /user/hive;
= add =
*ADD { FILE[S] | JAR[S] | ARCHIVE[S] } <filepath1> [<filepath2>]*
*hive> add jar /tmp/a.jar;
*hive> add jar /tmp/a.jar /tmp/b.jar;
= delete =
*DELETE { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..]
= list =
*LIST { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..]
*hive> list jar;
*hive> list jars;
= show =
*hive> show functions;
*hive> show tables;
*hive> show tables '*tianzhao*';
*hive> show partition tablename;
*hive> show table extended like table_with_partitions partition(ds=101);
= desc =
*hive> desc/describe function length;
*hive> desc/describe tablename;
*hive> desc/describe extended tablename; //显示表的信息
*hive> desc/describe extended tablename partition(ds=1); //显示partition的信息
*hive> desc/describe formatted tablename; //显示表的信息,跟extended相比,显示更友好
= source =
*hive> source /home/username/sql/test.sql;
= ! =
*hive> !ls; //ls当前目录
= quit =
hive> quit; 或者 hive> exit;
= hiveserver =
* $hive --service hiveserver
* $hive --service help
Usage ./hive <parameters> --service serviceName <service parameters>
Service List: cli help hiveserver hwi jar lineage metastore rcfilecat start-hive stop-hive
Parameters parsed:
--auxpath : Auxillary jars
--config : Hive configuration directory
--service : Starts specific service/component. cli is default
Parameters used:
HADOOP_HOME : Hadoop install directory
HIVE_OPT : Hive options
For help on a particular service:
./hive --service serviceName --help
*$hive --service start-hive
Starting Hive Thrift Server in Daemon Mode
starting jar, logging to /home/tianzhao/hive/hadoop-0.19.1/bin/../logs/hadoop-tianzhao-jar-ubuntu.out
*$hive --service stop-hive
Stopping Hive Thrift Server in Daemon Mode
stopping jar
[http://wiki.apache.org/hadoop/Hive/LanguageManual/Cli 官方的配置Wiki]
alter table s_spu set TBLPROPERTIES ('EXTERNAL'='TRUE'); //内部表转外部表
set hive.auto.convert.join=true;
set hive.exec.mode.local.auto=true;
set hive.mapred.local.mem = 200;
set hive.groupby.skewindata=true;
alter serde
数据:
a,b
c,d
e,f
hive> create table delim(key string, value string);
hive> load data local inpath '/home/tianzhao/Documents/delim' into table delim;
hive> select * from delim;
a,b NULL
c,d NULL
e,f NULL
hive> ALTER TABLE delim SET SERDEPROPERTIES ('field.delim' = ',');
a b
c d
e f
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-DropPartitions
ALTER TABLE page_view DROP PARTITION (dt='2008-08-08', country='us');
ALTER TABLE web_log ADD IF NOT EXISTS PARTITION (pt='20120325') LOCATION 'hdfs://localhost:9000/group/log1/2012/20120325';
ALTER TABLE web_log PARTITION(pt='20120325') SET FILEFORMAT SequenceFile;
ALTER TABLE r_table SET SERDEPROPERTIES ('serialization.null.format'=);
日志在: /tmp/$USER/hive.log 中
= hive启动 =
*$ hive –f script.q
*$ hive -e 'SELECT * FROM dummy‘
*$ hive -S -e 'SELECT * FROM dummy‘
*$ hive -hiveconf hive.root.logger=DEBUG,console
= set =
*hive> SET hive.enforce.bucketing=true; //设置值
*hive> SET hive.enforce.bucketing; // 显示值
*hive> set -v; //显示所有的值,包括hadoop的。
*hive> set; //显示跟基本的hadoop不同的配置,原理就是比对当前的所有选项与基本的配置是否不同,如修改过,已经不同了就打印该值。
= dfs 命令 =
dfs 命令可以执行 Shell 环境下的 hadoop fs 的所有命令
例如:
列出 HDFS 上的文件:
hive> dfs -ls /user/hive;
= add =
*ADD { FILE[S] | JAR[S] | ARCHIVE[S] } <filepath1> [<filepath2>]*
*hive> add jar /tmp/a.jar;
*hive> add jar /tmp/a.jar /tmp/b.jar;
= delete =
*DELETE { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..]
= list =
*LIST { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..]
*hive> list jar;
*hive> list jars;
= show =
*hive> show functions;
*hive> show tables;
*hive> show tables '*tianzhao*';
*hive> show partition tablename;
*hive> show table extended like table_with_partitions partition(ds=101);
= desc =
*hive> desc/describe function length;
*hive> desc/describe tablename;
*hive> desc/describe extended tablename; //显示表的信息
*hive> desc/describe extended tablename partition(ds=1); //显示partition的信息
*hive> desc/describe formatted tablename; //显示表的信息,跟extended相比,显示更友好
= source =
*hive> source /home/username/sql/test.sql;
= ! =
*hive> !ls; //ls当前目录
= quit =
hive> quit; 或者 hive> exit;
= hiveserver =
* $hive --service hiveserver
* $hive --service help
Usage ./hive <parameters> --service serviceName <service parameters>
Service List: cli help hiveserver hwi jar lineage metastore rcfilecat start-hive stop-hive
Parameters parsed:
--auxpath : Auxillary jars
--config : Hive configuration directory
--service : Starts specific service/component. cli is default
Parameters used:
HADOOP_HOME : Hadoop install directory
HIVE_OPT : Hive options
For help on a particular service:
./hive --service serviceName --help
*$hive --service start-hive
Starting Hive Thrift Server in Daemon Mode
starting jar, logging to /home/tianzhao/hive/hadoop-0.19.1/bin/../logs/hadoop-tianzhao-jar-ubuntu.out
*$hive --service stop-hive
Stopping Hive Thrift Server in Daemon Mode
stopping jar
[http://wiki.apache.org/hadoop/Hive/LanguageManual/Cli 官方的配置Wiki]
alter table s_spu set TBLPROPERTIES ('EXTERNAL'='TRUE'); //内部表转外部表
set hive.auto.convert.join=true;
set hive.exec.mode.local.auto=true;
set hive.mapred.local.mem = 200;
set hive.groupby.skewindata=true;
alter serde
数据:
a,b
c,d
e,f
hive> create table delim(key string, value string);
hive> load data local inpath '/home/tianzhao/Documents/delim' into table delim;
hive> select * from delim;
a,b NULL
c,d NULL
e,f NULL
hive> ALTER TABLE delim SET SERDEPROPERTIES ('field.delim' = ',');
a b
c d
e f
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-DropPartitions
ALTER TABLE page_view DROP PARTITION (dt='2008-08-08', country='us');
ALTER TABLE web_log ADD IF NOT EXISTS PARTITION (pt='20120325') LOCATION 'hdfs://localhost:9000/group/log1/2012/20120325';
ALTER TABLE web_log PARTITION(pt='20120325') SET FILEFORMAT SequenceFile;
ALTER TABLE r_table SET SERDEPROPERTIES ('serialization.null.format'=);
日志在: /tmp/$USER/hive.log 中
0 0
- Hive Cli<转>
- Hive Cli
- hive cli
- Hive Cli
- Hive Cli
- hive cli
- Hive CLI
- hive cli
- Hive Cli
- hive.cli
- Hive CLI
- Hive CLI
- Hive学习之Hive CLI
- hive cli命令行选项
- hive cli命令行选项
- hive cli命令行选项
- Hive 之CLI管理模式
- 2- Hive CLI
- cocos2d-x 动作的分类与使用
- 30分钟内快速理解面向对象思想
- DLUTOJ 1174
- java中的值传递和引用传递
- 黑马程序员 (高新技术)Myeclipse基本介绍与jdk1.5部分新特性学习总结
- Hive Cli<转>
- 关于Eclipse代码补全的一点小技巧
- LeetCode Valid Palindrome
- java虚拟机结构与机制
- VC++程序自己结束自己
- Git操作基本命令
- uva 10763 - Foreign Exchange
- 输入n(n<46)个学生的姓名和成绩,顺序输出这n个学生的姓名和成绩,并输出最高成绩的姓名和成绩。
- Ubuntu 12.04常用快捷键