Skip to content

Presto

Presto is an open-source distributed SQL query engine designed for running fast, interactive analytics on large datasets. It supports querying data from a variety of sources such as Hive, Cassandra, relational databases, and proprietary data stores. When integrated with Martini Runtime, Presto’s capabilities can be utilized to query large-scale datasets efficiently within a unified execution environment.

Configuring Presto

To configure Martini Runtime to connect to Presto, you need to set up a JDBC connection. This allows seamless interaction between the system and Presto, enabling the execution of queries and retrieval of data for analytics. Here's a simple guide to adding a new database connection:

Configuration Guide

Via API Explorer:
Database connections can be configured using the Martini API Explorer, a user-friendly interface for interacting with the system's APIs. Follow these steps to configure Presto database connections through the API Explorer:

  1. Access the API Explorer:
    Open a web browser and navigate to [HOST]:8080/api-explorer/ to access the API Explorer.

  2. Navigate to the Database Tag:
    Locate and click on the database tag within the API Explorer to explore the database configuration and operation endpoints.

  3. Configure Connection Pool:
    Use the esbapi/databases endpoint under the database tag to configure and save a new database connection pool.

  4. Use POST to Save a Connection Pool:
    Use the POST method at /esbapi/databases to save the connection pool. Below is an example of a minimum JSON payload to define a Presto connection:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
     {
         "name": "[name]",
         "autoStart": true,
         "status": "STARTED",
         "type": "jdbc",
         "url": "jdbc:presto://[HOST]:[PORT]",
         "xa": false,
         "driverClassName": "com.facebook.presto.jdbc.PrestoDriver",
         "username": "[username]",
         "password": "[password]",
         "acquireIncrement": 1,
         "acquisitionInterval": 1,
         "acquisitionTimeout": 30,
         "allowLocalTransactions": true,
         "autoCommit": true,
         "applyTransactionTimeout": false,
         "automaticEnlistingEnabled": true,
         "deferConnectionRelease": false,
         "enableJdbc4ConnectionTest": false,
         "ignoreRecoveryFailures": false,
         "isolationLevel": "READ_COMMITTED",
         "maxIdleTime": 60,
         "minPoolSize": 0,
         "maxPoolSize": 5,
         "preparedStatementCacheSize": 0,
         "shareTransactionConnections": false,
         "twoPcOrderingPosition": 0,
         "useTmJoin": true,
         "loginTimeout": 0
     }
    

    • url: Replace [HOST] and [PORT] with your Presto server host and port (default 8080).
    • driverClassName: Specifies the JDBC driver class for Presto.
    • username: Provide your Presto username.
    • password: Provide the corresponding password.

Via File System:
Alternatively, database connections can be configured directly in the file system by editing the <name>.dbxml file located in the /<martini-home>/conf/db-pool/ directory.

Follow these steps to modify Presto database connections directly through the file system:

  1. Locate the Configuration File:
    Navigate to the /<martini-home>/conf/db-pool/ directory on your server and find the <name>.dbxml file that corresponds to your Presto configuration.

  2. Edit the Database Connections:
    Open the <name>.dbxml file in a text editor and modify the Presto connection properties.

  3. Save and Restart:
    After editing the file, save the changes and restart the Martini Runtime instance.

Here is an example of the minimum dbXML configuration for Presto:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    <database>
        <name>[name]</name>
        <autoStart>true</autoStart>
        <type>jdbc</type>
        <url>jdbc:presto://[HOST]:[PORT]</url>
        <xa>false</xa>
        <driverClassName>com.facebook.presto.jdbc.PrestoDriver</driverClassName>
        <username>[username]</username>
        <password>[encrypted_password]</password>
        <acquireIncrement>1</acquireIncrement>
        <acquisitionInterval>1</acquisitionInterval>
        <acquisitionTimeout>30</acquisitionTimeout>
        <allowLocalTransactions>true</allowLocalTransactions>
        <autoCommit>true</autoCommit>
        <applyTransactionTimeout>false</applyTransactionTimeout>
        <automaticEnlistingEnabled>true</automaticEnlistingEnabled>
        <deferConnectionRelease>false</deferConnectionRelease>
        <enableJdbc4ConnectionTest>false</enableJdbc4ConnectionTest>
        <ignoreRecoveryFailures>false</ignoreRecoveryFailures>
        <isolationLevel>READ_COMMITTED</isolationLevel>
        <maxIdleTime>60</maxIdleTime>
        <minPoolSize>0</minPoolSize>
        <maxPoolSize>5</maxPoolSize>
        <preparedStatementCacheSize>0</preparedStatementCacheSize>
        <shareTransactionConnections>false</shareTransactionConnections>
        <twoPcOrderingPosition>0</twoPcOrderingPosition>
        <useTmJoin>true</useTmJoin>
        <loginTimeout>0</loginTimeout>
    </database>

Configuring Presto in Martini Designer

  1. In the Martini Designer's Navigator view, click on the Database icon to view available database connections.
  2. Right-click on Connections, and choose the option to add a new database connection.
  3. Specify a name for the connection and select the database type as JDBC.
  4. Fill in the required database connection details (host, port, username, password).
  5. Save the changes to establish the connection.

Connection Properties

For more details on constructing a JDBC connection URL for Presto, refer to the official Presto documentation: JDBC Connection URL Reference.

Database Properties

These properties are used to control various aspects of database behavior. For detailed information on configuring JDBC properties for Presto, refer to the Configuring JDBC on Martini Server Runtime Documentation.