Installing PrestoDB on Mac in 3 mins

Rishi Jain
Apr 30, 2020 · 3 min read

WHAT IS PRESTO?

Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.

Installation

Dependency to install Presto is only Java 8+ ( homebrew will take care of dependency )

brew install presto

As part of the install, the following files are created under the etc/ folder under the install directory:

* node.properties
* jvm.config
* config.properties
* log.properties

It also creates a sample JMX connector under the etc/catalog folder.

Starting/Stopping Presto

By default as part of the brew install, the presto CLI is installed at the following location:

/usr/local/Cellar/presto/<version>/bin

Both these executables are added to /usr/local/bin path and hence should already be available as part of $PATH.

Starting:

To start presto, we can use the helper script as follows:

$ presto-server start

This starts the service in the background. To start the service in the foreground, you can run:

$ presto-server run

To stop, when running in foreground, close the terminal or Ctrl + C. When running in background, use the presto-server helper script as follows:

$ presto-server stop

Accessing the Web UI:

After starting presto server, you can access the web UI using the following link:

http://localhost:8080

Presto CLI

The Presto CLI provides a terminal-based interactive shell for running queries. The CLI is a self-executing JAR file, which means it acts like a normal UNIX executable.

Go to you ‘/usr/local/Cellar/prestodb/0.230_1/libexec’ and you will find this self-executing jar already present.

Rename it to presto, make it executable with chmod +x, then run it:

$ mv presto-cli-0.230-executable.jar presto

./presto --server localhost:8080 --catalog $name --schema default

Run the CLI with the --help option to see the available options.

Let’s create MySQL catalog and connect to our MySQL database

  1. Create catalog file mysql.properties

Note: I have MySQL running locally on my system, but you can change the connection-url to point your MySQL

2. Now let’s connect to this via presto

Note: In presto, terminology schema is equivalent to MySQL DB name

Mac O’Clock

The best stories for Apple owners and enthusiasts

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store