hive cli命令行选项
来源:互联网 发布:淘宝购物比价软件 编辑:程序博客网 时间:2024/05/21 06:57
Hive Command line Options
Usage:
Usage: hive [-hiveconf x=y]* [<-i filename>]* [<-f filename>|<-e query-string>] [-S] -i <filename> Initialization Sql from file (executed automatically and silently before any other commands) -e 'quoted query string' Sql from command line -f <filename> Sql from file -S Silent mode in interactive shell where only data is emitted -v Verbose mode (echo executed SQL to the console) -p <port> connect to Hive Server on port number -hiveconf x=y Use this to set hive/hadoop configuration variables. -e and -f cannot be specified together. In the absence of these options, interactive shell is started. However, -i can be used with any other options. Multiple instances of -i can be used to execute multiple init scripts. To see this usage help, run hive -h
- 从命令行执行指定的sql语句
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a'
- 以指定的hive环境变量执行指定的sql语句
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a' -hiveconf hive.exec.scratchdir=/home/my/hive_scratch -hiveconf mapred.reduce.tasks=32
- 以沉默模式执行指定的sql语句,并将执行结果导出到指定文件
HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt
- 以非交互式模式执行sql文件
HIVE_HOME/bin/hive -f /home/my/hive-script.sql
- 在进入交互模式之前,执行初始化sql文件
HIVE_HOME/bin/hive -i /home/my/hive-init.sql
Hive 交互式Shell命令
当命令 $HIVE_HOME/bin/hive以不带 -e/-f 选项的方式运行时, hive将进入到交互模式。以(;)冒号结束命令行。评论信息通过在行首添加 (--).
Sample Usage:
hive> set mapred.reduce.tasks=32; hive> set; hive> select a.* from tab1; hive> !ls; hive> dfs -ls;
Logging
Hive uses log4j for logging. These logs are not emitted to the standard output by default but are instead captured to a log file specified by Hive's log4j properties file. By default Hive will usehive-log4j.default in theconf/ directory of the hive installation which writes out logs to/tmp/<userid>/hive.log and uses theWARN level.
It is often desirable to emit the logs to the standard output and/or change the logging level for debugging purposes. These can be done from the command line as follows:
$HIVE_HOME/bin/hive -hiveconf hive.root.logger=INFO,console
hive.root.logger specifies the logging level as well as the log destination. Specifyingconsole as the target sends the logs to the standard error (instead of the log file).
Hive Resources
Hive can manage the addition of resources to a session where those resources need to be made available at query execution time. Any locally accessible file can be added to the session. Once a file is added to a session, hive query can refer to this file by its name (in map/reduce/transform clauses) and this file is available locally at execution time on the entire hadoop cluster. Hive uses Hadoop's Distributed Cache to distribute the added files to all the machines in the cluster at query execution time.
Usage:
ADD { FILE[S] | JAR[S] | ARCHIVE[S] } <filepath1> [<filepath2>]* LIST { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..] DELETE { FILE[S] | JAR[S] | ARCHIVE[S] } [<filepath1> <filepath2> ..]
- FILE resources are just added to the distributed cache. Typically, this might be something like a transform script to be executed.
- JAR resources are also added to the Java classpath. This is required in order to reference objects they contain such as UDF's.
- ARCHIVE resources are automatically unarchived as part of distributing them.
Example:
hive> add FILE /tmp/tt.py; hive> list FILES; /tmp/tt.py hive> from networks a MAP a.networkid USING 'python tt.py' as nn where a.ds = '2009-01-04' limit 10;
It is not neccessary to add files to the session if the files used in a transform script are already available on all machines in the hadoop cluster using the same path name. For example:
- ... MAP a.networkid USING 'wc -l' ...: here wc is an executable available on all machines
- ... MAP a.networkid USING '/home/nfsserv1/hadoopscripts/tt.py' ...: here tt.py may be accessible via a nfs mount point that's configured identically on all the cluster nodes.
- 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.cli
- Hive CLI
- Hive CLI
- Hive学习之Hive CLI
- Hive Cli<转>
- Hive 之CLI管理模式
- rails3 和 thinking_sphinx安装(brown_zhang)
- 如何学VC++?
- 简单命令回顾
- 插件46:简单的web代理服务器
- reids按天分割日志
- hive cli命令行选项
- Jquery调用webservices(各种返回值)
- select、poll与epoll的区别
- 安装pig时遇到的问题
- <sys/stat.h>的含义!
- JPA中关于MS SQL Server数据库的TimeStamp数据类型如何映射
- 【转】经典.net面试题目
- hadoop的回收站功能
- css 清除浮动