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.
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:
It also creates a sample JMX connector under the etc/catalog folder.
By default as part of the brew install, the presto CLI is installed at the following location:
Both these executables are added to /usr/local/bin path and hence should already be available as part of $PATH.
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:
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
- 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