MaxCompute Console 实用小命令

MaxCompute Console 可以从 这里 下载。在阿里云官网可以查看 帮助文档。 这里跟大家分享一些 MaxCompute Console 中实用的小命令。

MaxCompute Console 可以从 这里 下载。在阿里云官网可以查看 帮助文档。

这里跟大家分享一些 MaxCompute Console 中实用的小命令。嗯,一般人我不告诉他~

1 odpscmd -v 查看 odpscmd 版本

/Users/zhenhong/tool/odps_clt ./bin/odpscmd -v******Odps Command Line Tools******Buildtime: 2016-06-27 18:14:48Revision: 30d623dMavenVersion: 0.24.0-snapshotBranch: develop

2 开启 debug 模式

在 odps_config.ini 中加一行:debug=true,将开启调试模式。之后在 odpscmd 运行过程中会输出 debug 日志、异常 stacktrace 等,方便定位问题。

/Users/zhenhong/tool/odps_clt cat conf/odps_config.inidebug=trueaccess_id=***access_key=***end_point=project_name=

运行 odpscmd,输入错误命令,将会看到错误日志

/Users/zhenhong/tool/odps_clt ./bin/odpscmd[DEBUG]:ODPSConsole StartAliyun ODPS Command Line ToolVersion 0.24.0-snapshot@copyright 2015 Alibaba Cloud Computing Co., Ltd. All rights reserved.odps@ odps_test_tunnel_project_gcc492>ll tables;FAILED: ODPS-0130161:Parse exception - line 1:0 cannot recognize input near ‘ll’ ‘tables’ ‘’[DEBUG]: com.aliyun.openservices.odps.console.ODPSConsoleException: ODPS-0130161:Parse exception - line 1:0 cannot recognize input near ‘ll’ ‘tables’ ‘’ at com.aliyun.openservices.odps.console.QueryCommand.run(QueryCommand.java:212)。。。

3 help <命令关键字> 获取命令使用提示

大多数同学都知道使用 odpscmd -h 或者 help;来获取 odpscmd 的所有命令提示。
除了这个,我们还有专门的 help + 关键字 命令呢。例如,使用help ls; 获取与 ls 相关的命令;使用 help table; 命令来获取所有与 table 相关的命令提示。

/Users/zhenhong/tool/odps_clt ./bin/odpscmd[DEBUG]:ODPSConsole StartAliyun ODPS Command Line ToolVersion 0.24.0-snapshot@Copyright 2015 Alibaba Cloud Computing Co., Ltd. All rights reserved.odps@ odps_test_tunnel_project_gcc492>help table;Usage: show tables [in ] list|ls tables [-p,-project ]Usage: export table Usage: alter table merge smallfilesUsage: read <table_name> [<(col_name>[,…])][PARTITION <(partition_spec)>][line_num]

是不是很方便呢?再也不用去翻文档了!

另外,负责数据上传下载 tunnel 命令,除了有 help tunnel; 来获取提示,还有tunnel help 来获取详细命令提示,下面例子使用 tunnel help download; 得到与下载相关的命令参数。

odps@ odps_test_tunnel_project_gcc492>tunnel help download;usage: tunnel download [options] <[project.]table[/partition]> download data to local file -c,-charset specify file charset, default ignore. set ignore to download raw data。。。。(此处省略大量参数提示) -tz,-time-zone time zone, default local timezone: Asia/ShanghaiExample: tunnel download test_project.test_table/p1=“b1”,p2=“b2” log.txt

4 wait 获取 instance 详细信息:logview、 summary 等

当一个作业已经运行完成,或者被放到后台执行,我们就不能再看到 instance 相关的执行信息,包括 logview 链接、instance summary、instance 运行的结果等等。这个时候,使用 wait 命令可以再次获取到这些信息。

odps@ odps_test>wait 20161008231329221gr58pvyi2;ID = 20161008231329221gr58pvyi2Log view:http://logview.odps.aliyun-inc.com:8080/logview/?h=http://***:***/***&p=odps_test&i=20161008231329221gr58pvyi2&token=********Summary:resource cost: cpu 0.00 Core * Min, memory 0.00 GB * Mininputs: odps_test.src: 500 (2608 bytes)outputs:[此处省略。。。]"_c0"500

5 命令自动补全

由于历史原因,odpscmd 的命令没有统一的规范,完整的命令补全不是很好做,但是在 0.23.0 版本之后,我们做了命令关键字和文件路径的自动补全,使用TAB键即可。

下面列出输入不同字符后,敲 TAB 键的结果:

odps@ test_new_console_gcc>tunnel upupdate updateabtest uploadodps@ test_new_console_gcc>tunnel upload test_dual ./tetest test_body test_dual test_dual1 test_header test_out test_value textodps@ test_new_console_gcc>add resource /tmp/com.apple.launchd.1YmqQ8L2kK com.apple.launchd.26PWVPElv8 entsafemgr.log

6 history 命令查看历史

用来找曾经写过的命令,特别方便哦。

odps@ test_new_console_gcc>history;1 count src;2 select t1.prediction_result from pai_pred_output_perd_14561096286930 t1 join pai_pred_output_perd_14561096286930 t2 on t1.label ==t2.label;3 desc instance 20160811091342933gtvve03;4 desc instance 20160811091342933gtvve03;5 wait 20160811091342933gtvve03;(省略 。。。)

注: 最多缓存 500 条历史命令

7 版本更新自动提示

在最新的开发版本中,我们添加了版本的更新提示功能,先露个脸吧:

/Users/zhenhong/tool/odps_clt ./bin/odpscmdAliyun ODPS Command Line ToolVersion 0.25.0-snapshot@Copyright 2015 Alibaba Cloud Computing Co., Ltd. All rights reserved.New version 0.25.1 available! Try it now! http://repo.aliyun.com/odpscmd/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值