<commit_before>---
layout: global
title: Running Presto with Alluxio
nickname: Presto
group: Compute Integrations
priority: 2
---

[Presto](https://prestosql.io/)
is an open source distributed SQL query engine for running interactive analytic queries
on data at a large scale.
This guide describes how to run queries against Presto with Alluxio as a distributed caching layer,
for any data storage systems that Alluxio supports (AWS S3, HDFS, Azure Blob Store, NFS, and more).
Alluxio allows Presto access data regardless of the data source and transparently cache frequently
accessed data (e.g., tables commonly used) into Alluxio distributed storage.
Co-locating Alluxio workers with Presto workers improves data locality and reduces the I/O access
latency when other storage systems are remote or the network is slow or congested.

* Table of Contents
{:toc}

## Using Presto with the Alluxio Catalog Service
Currently, there are 2 ways to enable Presto to interact with Alluxio:
* Presto interacts with the [Alluxio Catalog Service]({{ '/en/core-services/Catalog.html' | relativize_url }})
* Presto interacts directly with the Hive Metastore (with table definitions updated to use Alluxio paths)

The primary benefits for using Presto with the Alluxio Catalog Service are
- Simpler deployments of Alluxio with Presto (no modifications to the Hive Metastore)
- Enabling schema-aware optimizations (transformations like coalescing and file conversions).

Currently, the catalog service is limited to read-only workloads.

For more details and instructions on how to use the Alluxio Catalog Service with Presto, please
visit the [Alluxio Catalog Service documentation]({{ '/en/core-services/Catalog.html' | relativize_url }}).

The rest of this page discusses the alternative approach of Presto directly interacting with the
Hive Metastore, while IO access is performed through Alluxio.

## Prerequisites

* Setup Java for Java 8 Update 161 or higher (8u161+), 64-bit.
* For PrestoSQL version >= 330, you will need to Setup Java 11.
* [Deploy Presto](https://prestosql.io/docs/current/installation/deployment.html).
This guide is tested with `presto-315`.
* Alluxio has been set up and is running.
* Make sure that the Alluxio client jar is available.
  This Alluxio client jar file can be found at `{{site.ALLUXIO_CLIENT_JAR_PATH}}` in the tarball
  downloaded from Alluxio [download page](https://www.alluxio.io/download).
* Make sure that Hive Metastore is running to serve metadata information of Hive tables.

## Basic Setup

### Configure Presto to connect to Hive Metastore

Presto gets the database and table metadata information (including file system locations) from
the Hive Metastore, via Presto's Hive connector.
Here is a example Presto configuration file `${PRESTO_HOME}/etc/catalog/hive.properties`,
for a catalog using the Hive connector, where the metastore is located on `localhost`.

```properties
connector.name=hive-hadoop2
hive.metastore.uri=thrift://localhost:9083
```

### Distribute the Alluxio client jar to all Presto servers

In order for Presto to be able to communicate with the Alluxio servers, the Alluxio client
jar must be in the classpath of Presto servers.
Put the Alluxio client jar `{{site.ALLUXIO_CLIENT_JAR_PATH}}` into the directory<commit_msg>[DOCFIX] Update tested Presto version<commit_after>---
layout: global
title: Running Presto with Alluxio
nickname: Presto
group: Compute Integrations
priority: 2
---

[Presto](https://prestosql.io/)
is an open source distributed SQL query engine for running interactive analytic queries
on data at a large scale.
This guide describes how to run queries against Presto with Alluxio as a distributed caching layer,
for any data storage systems that Alluxio supports (AWS S3, HDFS, Azure Blob Store, NFS, and more).
Alluxio allows Presto access data regardless of the data source and transparently cache frequently
accessed data (e.g., tables commonly used) into Alluxio distributed storage.
Co-locating Alluxio workers with Presto workers improves data locality and reduces the I/O access
latency when other storage systems are remote or the network is slow or congested.

* Table of Contents
{:toc}

## Using Presto with the Alluxio Catalog Service
Currently, there are 2 ways to enable Presto to interact with Alluxio:
* Presto interacts with the [Alluxio Catalog Service]({{ '/en/core-services/Catalog.html' | relativize_url }})
* Presto interacts directly with the Hive Metastore (with table definitions updated to use Alluxio paths)

The primary benefits for using Presto with the Alluxio Catalog Service are
- Simpler deployments of Alluxio with Presto (no modifications to the Hive Metastore)
- Enabling schema-aware optimizations (transformations like coalescing and file conversions).

Currently, the catalog service is limited to read-only workloads.

For more details and instructions on how to use the Alluxio Catalog Service with Presto, please
visit the [Alluxio Catalog Service documentation]({{ '/en/core-services/Catalog.html' | relativize_url }}).

The rest of this page discusses the alternative approach of Presto directly interacting with the
Hive Metastore, while IO access is performed through Alluxio.

## Prerequisites

* Setup Java for Java 8 Update 161 or higher (8u161+), 64-bit.
* For PrestoSQL version >= 330, you will need to Setup Java 11.
* [Deploy Presto](https://prestosql.io/docs/current/installation/deployment.html).
This guide is tested with `presto-319`.
* Alluxio has been set up and is running.
* Make sure that the Alluxio client jar is available.
  This Alluxio client jar file can be found at `{{site.ALLUXIO_CLIENT_JAR_PATH}}` in the tarball
  downloaded from Alluxio [download page](https://www.alluxio.io/download).
* Make sure that Hive Metastore is running to serve metadata information of Hive tables.

## Basic Setup

### Configure Presto to connect to Hive Metastore

Presto gets the database and table metadata information (including file system locations) from
the Hive Metastore, via Presto's Hive connector.
Here is a example Presto configuration file `${PRESTO_HOME}/etc/catalog/hive.properties`,
for a catalog using the Hive connector, where the metastore is located on `localhost`.

```properties
connector.name=hive-hadoop2
hive.metastore.uri=thrift://localhost:9083
```

### Distribute the Alluxio client jar to all Presto servers

In order for Presto to be able to communicate with the Alluxio servers, the Alluxio client
jar must be in the classpath of Presto servers.
Put the Alluxio client jar `{{site.ALLUXIO_CLIENT_JAR_PATH}}` into the directory
{'fraction_non_alphanumeric': 0.06365565322825098, 'fraction_numerical': 0.007881176113973931, 'mean_word_length': 4.982774252039891, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287555', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1777, 'n_words': 871}