- 假如创建/root/presto_client目录,作为presto_client的根目录。
- 下载jdk至此目录。
- 下载 presto-cli-0.100-executable.jar至此目录。
- 相关依赖结构如下:
5.编写命令启动脚本presto_cli,相关截图如下:
6.在shell 脚本下运行: presto_cli schemaName 即可登录成功相关catalog为hive,schema为schemaName
【2】presto Statement Resource
presto查询是向cordination节点post一个查询的请求,并分析response内容,如果含有nextUri,则查询还未完成,继续调用nextUri,直至response中不含有nextUri,则查询结束。
(1) function:: POST /v1/statement --提交查询请求 可以提交一个statment至此url执行presto查询,其消息头说明如下:
function:: POST /v1/statement :query query: SQL Query to execute :reqheader X-Presto-User: User to execute statement on behalf of (optional) :reqheader X-Presto-Source: Source of query :reqheader X-Presto-Catalog: Catalog to execute query against :reqheader X-Presto-Schema: Schema to execute query against
(2)function:: GET /v1/statement/{queryId}/{token} --继续查询直至查询完成
:query queryId: The query identifier returned from the initial POST to /v1/statement
:query token: The token returned from the initial POST to /v1/statement or from a previous call to this same call
提交至(1)中的请求的response中含有nextUri属性,客户端可通过这个nextUri连接继续获取查询的进度或者最后的结果,当resoponse中不存在nextUri时,则认为此查询已完成,可通过response中data属性获取结果。
(3)function:: DELETE /v1/statement/{queryId}/{token} --删除此查询
:query queryId: The query identifier returned from the initial POST to /v1/statement :reqheader X-Presto-User: User to execute statement on behalf of (optional) :reqheader X-Presto-Source: Source of query :reqheader X-Presto-Catalog: Catalog to execute query against :reqheader X-Presto-Schema: Schema to execute query against
关于此方面更具体信息,可参照链接,
https://github.com/prestodb/presto/blob/master/presto-docs/src/main/sphinx/rest/statement.rst