presto cli 命令行使用

本文详细介绍了如何下载并配置Presto CLI工具,包括在高安全集群中使用Kerberos进行身份验证的方法。同时,提供了启动Presto Server的命令,帮助读者快速上手Presto SQL查询引擎。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、在 http://prestodb.github.io/docs/current/installation/cli.html 下载

Download presto-cli-0.223-executable.jar, rename it to presto, make it executable with chmod +x, then run it:

./presto --server emr-header-1:9090 --catalog hive --schema default --user hadoop

高安全集群使用如下命令形式:

$ presto  --server https://emr-header-1:7778  \
          --enable-authentication \
          --krb5-config-path /etc/krb5.conf \
          --krb5-keytab-path  /etc/ecm/presto-conf/presto.keytab \
          --krb5-remote-service-name presto \
          --keystore-path /etc/ecm/presto-conf/keystore \
          --keystore-password 81ba14ce6084 \
          --catalog hive --schema default \
          --krb5-principal  presto/emr-header-1.cluster-XXXX@EMR.XXXX.COM

XXXX 为集群的 ecm id,为一串数字,可以通过 cat /etc/hosts 获取。
81ba14ce6084 为 /etc/ecm/presto-conf/keystore 的默认密码,建议部署后替换为自己的 keystore.
接下来就可已在该控制台下执行以下命令:

presto:default> show schemas;
    Schema
--------------------
default
hive
information_schema
tpch_100gb_orc
tpch_10gb_orc
tpch_10tb_orc
tpch_1tb_orc

(7 rows)
执行 presto --help 命令可以获取控制台的帮助,各个参数对解释如下所示:

--server <server>                       # 指定Coordinator的URI
--user <user>                           # 设置用户名
--catalog <catalog>                     # 指定默认的Catalog
--schema <schema>                       # 指定默认的Schema
--execute <execute>                     # 执行一条语句,然后退出
-f <file>, --file <file>                # 执行一个SQL文件,然后退出
--debug                                 # 显示调试信息
--client-request-timeout <timeout>      # 指定客户端超时时间,默认为2m
--enable-authentication                 # 使能客户端认证
--keystore-password <keystore password> # KeyStore密码
--keystore-path <keystore path>         # KeyStore路径
--krb5-config-path <krb5 config path>   # Kerberos配置文件路径(默认为/etc/krb5.conf)
--krb5-credential-cache-path <path>     # Kerberos凭据缓存路径
--krb5-keytab-path <krb5 keytab path>   # Kerberos Key table路径
--krb5-principal <krb5 principal>       # 要使用的Kerberos principal
--krb5-remote-service-name <name>       # 远程Kerberos节点名称
--log-levels-file <log levels>          # 调试日志配置文件路径
--output-format <output-format>         # 批量导出的数据格式,默认为 CSV
--session <session>                     # 指定回话属性,格式如下 key=value
--socks-proxy <socks-proxy>             # 设置代理服务器
--source <source>                       # 设置查询的Source
--version                               # 显示版本信息
-h, --help                              # 显示帮组信息

2、启动Server命令

./bin/launcher --config /home/hive/presto-server-0215/etc/config.properties  run
./bin/launcher --config /home/hive/presto-server-0215/etc/config.properties  start

或不指定配置文件

./bin/launcher   run
./bin/launcher  start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值