Hive Cli,
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 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
[http://wiki.apache.org/hadoop/Hive/LanguageManual/Cli 官方的配置Wiki]