testbook

Transwarp CLI和 Inceptor交互式Shell

Transwarp CLI选项
前缀:transwarp

命令说明
-t -h <Inceptor Server IP >进入Inceptor交互式shell
-H, --help帮助
-e行内嵌入Inceptor SQL命令
-f <文件名>运行指定脚本
--hiveconf指定配置文件
-i<文件名>初始化指定文件
-S安静模式,也就是不输出操作运行时的信息
-v详细模式
举例
  • 命令行嵌入HiveQL查询:
  • transwarp -e select a.col from tab1 a
    
  • 设定配置变量
  • transwarp -e 'select a.col from tab1 a' --hiveconf hive.exec.scratchdir=/home/my/hive_scratch  --hiveconf mapred.reduce.tasks=32
    
  • 在安静模式下将查询得到的数据输出至文件
  • transwarp -S -e 'select a.col from tab1 a' > a.txt 
  • 运行指定脚本
  • transwarp -f /home/my/script.sql
    
  • 初始化脚本
  • transwarp -i /home/my/init.sql
    
Inceptor 交互式Shell指令
在Transwarp CLI执行transwarp -t -h (inceptor_server_ip),就可以进入Inceptor 交互式shell,以下是在交互式shell中可以用的命令。我们可以是通过shell和Inceptor进行交互,发出Inceptor SQL命令。和Inceptor进行交互时,命令结尾要以分号结尾来表示命令结束。
命令描述
quit, exit退出交互式shell
reset将配置重置为默认值
set <key>=<value>设置某个配置变量的值。注意:如果配置变量名拼错了,CLI不会报错。
set打印一列被用户或者Inceptor覆盖的配置变量。
set -v打印所有Hadoop和Hive的配置变量。
add FILE[S] <filepath> <filepath>*
add JAR[S] <filepath> <filepath>*
add ARCHIVE[S] <filepath> <filepath>*
将一个或多个文件、jar包或者档案加进分布式缓存的资源列表中。
list FILE[S]
list JAR[S]
list ARCHIVE[S]
列出已经加入分布式缓存的资源。
list FILE[S] <filepath>*
list JAR[S] <filepath>*
list ARCHIVE[S] <filepath>*
检查给出的资源是否已经被加入分布式缓存。
delete FILE[S] <filepath>*
delete JAR[S] <filepath>*
delete ARCHIVE[S]<filepath>*
将资源从分布式缓存中移除
! <command>从Inceptor交互式shell运行Transwarp CLI的指令
dfs <dfs command>从Inceptor交互式shell运行DFS指令
<query string>运行Inceptor SQL指令并将结果打印到standard output
source FILE <filepath>在交互式shell里运行脚本