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