Updated on 2024-12-10 GMT+08:00

Commissioning a Presto Application

Running the JDBC Client and Viewing Results

  1. Run the mvn clean compile assembly:single command to generate a JAR file and obtain it from the target directory in the project directory, for example, presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar.
  2. Create a directory as the running directory in the running and commissioning environment, for example, /opt/presto_examples (Linux), and create the conf subdirectory in the directory.

    Copy presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar exported in 1 to /opt/presto_examples.

  3. To enable Kerberos authentication for a cluster, you need to copy the obtained user.keytab and krb5.conf files to the /opt/presto_examples/conf directory and modify the presto.preperties file in the conf directory of the sample code. Skip this step for a cluster with Kerberos authentication disabled.

    Table 1 presto.preperties parameters

    Parameter

    Description

    user

    Username used for Kerberos authentication, that is, the development user created in Preparing a Presto Application Development User.

    KerberosPrincipal

    Username used for authentication. That is, the development user created in Preparing a Presto Application Development User needs to be certificated.

    KerberosConfigPath

    Path where krb5.conf is stored

    KerberosKeytabPath

    Path where user.keytab is stored

    Example

    user = prestouser
    SSL = true
    KerberosRemoteServiceName = HTTP
    KerberosPrincipal = prestouser
    KerberosConfigPath = /opt/presto_examples/conf/krb5.conf
    KerberosKeytabPath = /opt/presto_examples/conf/user.keytab

  4. In Linux, run the sample program.

    chmod +x /opt/presto_examples -R 
    cd /opt/presto_examples
    java -jar presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar

  5. In the CLI, view the query results of the example code.

    If the following information is displayed, the sample project execution is successful in Linux.
    NY Metro : 2
    Mid Atlantic : 6
    Mid Atlantic : 6
    North Midwest : 1
    North Midwest : 3
    North Midwest : 7