Presto 102 Tutorial: Install PrestoDB on a Laptop or PC

Summary

Prestodb is an open source distributed parallel query SQL engine. In tutorial 101 we walk through manual installation and configuration on a bare metal server or on a VM. It is a very common practice to try prestodb on a laptop for quick validation and this guide, Tutorial 102, will walk through simple steps to install a three node prestodb cluster on a laptop. 

Environment

This guide was developed using a laptop running windows OS and docker on it. 

Steps for Implementing Presto

Step 1: 

Create a docker network namespace, so that containers could communicate with each other using the network namespace.

C:\Users\rupendran>docker network create presto_networkd0d03171c01b5b0508a37d968ba25638e6b44ed4db36c1eff25ce31dc435415b

Step 2

Ahana has developed a sandbox for prestodb which can be downloaded from docker hub, use the below command to download prestodb sandbox, which comes with all packages needed to run prestodb.

C:\Users\prestodb>docker pull ahanaio/prestodb-sandbox
Using default tag: latestlatest: Pulling
from ahanaio/prestodb-sandboxda5a05f6fddb: Pull complete
e8f8aa933633: Pull complete
b7cf38297b9f: Pullcomplete
a4205d42b3be: Pull complete
81b659bbad2f: Pull complete
3ef606708339: Pull complete
979857535547: Pull complete
Digest: sha256:d7f4f0a34217d52aefad622e97dbcc16ee60ecca7b78f840d87c141ba7137254Status:
Downloaded newer image for ahanaio/prestodb-sandbox:latestdocker.io/ahanaio/prestodb-sandbox:latest

Step 3:

Start the instance of the the prestodb sandbox and name it as coordinator.

C:\Users\prestodb>docker run -d -p 8080:8080 -it --net presto_network --name coordinator ahanaio/prestodb-sandboxdb74c6f7c4dda975f65226557ba485b1e75396d527a7b6da9db15f0897e6d47f

Step 4:

Check cluster UI on the status, by default the Ahana prestodb sandbox comes with one worker and a coordinator.

If only the coordinator needs to be running without the worker node then edit  the config.properties file and set the node-scheduler.include-cooridinator to false.

sh-4.2# cat etc/config.properties
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8080
discovery-server.enabled=true
discovery.uri=http://localhost:8080
sh-4.2#

Now the prestodb UI will show Active worker count to 0.

Step 5: 

Start another instance of prestodb sandbox which will run as worker node

C:\Users\rupendran>docker run -d -p 8081:8081 -it --net presto_network --name workerN1 ahanaio/prestodb-sandbox
80dbb7e1d170434e06c10f9316983291c10006d53d9c6fc8dd20db60ddb4a58c

Step 6: 

Since sandbox comes with coordinator it needs to be disabled for the second instance and run it as worker node, to do that click on the terminal window on the docker container/apps UI  and edit etc/config.properties file to set coordinator to false and set http port to be different from coordinator.

sh-4.2# cat etc/config.properties
coordinator=false
http-server.http.port=8081
discovery.uri=http://coordinator:8080
sh-4.2#

Step 7:

Restart the worker1 container check prestodb UI, now the active worker count will be set to either 1 if co-ordinator runs without a worker node or 2 if the coordinator also runs a worker node.

Step 8:

Repeat steps 5 to 7 to add a third worker node. 

  • start new instance of Ahanaio/prestodb sandbox
  • Disable coordinator and set port to be different than coordinator and set URI to the container name of the coordinator

C:\Users\rupendran>docker run -d -p 8082:8082 -it --net presto_network --name workerN2 ahanaio/prestodb-sandbox
16eb71da54d4a9c30947970ff6da58c65bdfea9cb6ad0c76424d527720378bdd

Step 9: 

Check cluster status, should reflect the third worker node as part of the prestodb cluster.

Step 10:

Verify the prestodb environment by running the prestodb CLI with simple tpch query

sh-4.2# presto-cli
presto> SHOW SCHEMAS FROM tpch;

Schema

information_schema
sf1
sf100
sf1000
sf10000
sf100000
sf300
sf3000
sf30000
tiny
(10 rows)

Query 20210709_195712_00006_sip3d, FINISHED, 3 nodes
Splits: 36 total, 36 done (100.00%)
0.01 [10 rows, 119B] [12 row/s, 153B/s]

presto>

Summary:

Prestodb cluster installation is simplified with Ahana prestodb sandbox. It’s now ready to be used for any functional validation.