This topic describes how to use a command-line interface (CLI) to perform operations in the Presto console.


An E-MapReduce (EMR) Hadoop cluster is created, and Presto is selected from the optional services during the cluster creation. For more information about how to create a cluster, see Create a cluster.


  1. Log on to the master node of the cluster by using SSH.
  2. Run the following command to go to the installation directory of Presto:
    cd /usr/lib/presto-current/bin
  3. Run the following command to access the Presto console:
    presto --server emr-header-1:9090 --catalog hive --schema default --user hadoop
    If you use a high-security cluster, run the following command:
    $ 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
    • You can run the hostname command to obtain your hostname and replace XXXX in the command with the hostname.
    • 81ba14ce6084 is the default password of the keystore that is stored in the /etc/ecm/presto-conf/ directory.
  4. Run the following command to view the schemas contained in the existing catalog:
    show schemas;
    The following information is returned:
    (3 rows)
    Query 20200817_071327_00026_8krrw, FINISHED, 3 nodes
    Splits: 36 total, 36 done (100.00%)
    0.25 [3 rows, 57B] [12 rows/s, 229B/s]

    Run the presto --help command to obtain help information from the console. The following help information contains relevant parameters and their descriptions.

    --server <server>                       # Specify the URI of the coordinator node.
    --user <user>                           # Specify the username.
    --catalog <catalog>                     # Specify the default catalog.
    --schema <schema>                       # Specify the default schema.
    --execute <execute>                     # Execute a statement and then exit.
    -f <file>, --file <file>                # Execute an SQL file and then exit.
    --debug                                 # Show debugging information.
    --client-request-timeout <timeout>      # Specify the request timeout period of the client. Default value: 2m.
    --enable-authentication                 # Enable client-side authentication.
    --keystore-password <keystore password> # The password of the keystore.
    --keystore-path <keystore path>         # The keystore storage path.
    --krb5-config-path <krb5 config path>   # The storage path of the Kerberos configuration file. Default value: /etc/krb5.conf.
    --krb5-credential-cache-path <path>     # The path used to cache the Kerberos credential.
    --krb5-keytab-path <krb5 keytab path>   # The path used to store the keytab file of Kerberos.
    --krb5-principal <krb5 principal>       # The Kerberos principal to be used.
    --krb5-remote-service-name <name>       # The name of the remote Kerberos node.
    --log-levels-file <log levels>          # The configuration file path for debugging logs.
    --output-format <output-format>         # The format in which a large amount of data is exported at the same time. Default value: CSV.
    --session <session>                     # Specify the session attribute in the format of key=value.
    --socks-proxy <socks-proxy>             # Specify the proxy server.
    --source <source>                       # Specify the query source.
    --version                               # Show the version information.
    -h, --help                              # Show the help information.
  5. Optional: Run the quit; command to log off from the Presto console.