How to setup multi node presto cluster ?

Fist of all you need to download the presto-server binary from its website.

[root@namenode admin]# wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.164/presto-server-0.164.tar.gz
--2017-03-29 12:22:26--  https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.164/presto-server-0.164.tar.gz
Resolving repo1.maven.org (repo1.maven.org)... 151.101.24.209
Connecting to repo1.maven.org (repo1.maven.org)|151.101.24.209|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 406230611 (387M) [application/x-gzip]
Saving to: ‘presto-server-0.164.tar.gz’

 0% [                                                                                                                                                     ] 981,144     68.6KB/s  eta 69m 7s
[root@namenode admin]#tar -xvf presto-server-0.164.tar.gz 
[root@namenode admin]# cd presto-server-0.164/
[root@namenode presto-server-0.164]# ls
bin  etc  lib  NOTICE  plugin  README.txt
[root@namenode presto-server-0.164]# wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.164/presto-cli-0.164-executable.jar
--2017-03-29 12:28:41--  https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.164/presto-cli-0.164-executable.jar
Resolving repo1.maven.org (repo1.maven.org)... 151.101.24.209
Connecting to repo1.maven.org (repo1.maven.org)|151.101.24.209|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15093095 (14M) [application/java-archive]
Saving to: ‘presto-cli-0.164-executable.jar’

 5% [======>                                                                                                                                              ] 794,624      202KB/s  eta 72s    

[root@namenode presto-server-0.164]# mv presto-cli-0.164-executable.jar presto
[root@namenode presto-server-0.164]# sudo chmod +x presto

Now you need to create a folder name “etc” in your presto binary directory and create another folder name catelog in side your etc folder. Then in your catalog folder you have to create two properties files which is hive.properties and another one is jmx.properties. Once you are done you need to create another 4 config and properties file inside your etc folder and your folder structure will be given bellow.

[root@namenode presto-server-0.164]# tree etc/
etc/
├── catalog
│   ├── hive.properties
│   └── jmx.properties
├── config.properties
├── jvm.config
├── log.properties
└── node.properties

1 directory, 6 files

Now you are ready to configure your presto etc folder. Here are the configuration files signature what you need to simply paste inside a specific file.
hive.properties

[root@namenode presto-server-0.164]# cat etc/catalog/hive.properties
hive.metastore.uri=thrift://datanode2.selise.ch:9083
connector.name=hive-hadoop2

jmx.properties

[root@namenode presto-server-0.164]# cat etc/catalog/jmx.properties
connector.name=jmx

config.properties

[root@namenode presto-server-0.164]# cat etc/config.properties
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8081
query.max-memory=800MB
query.max-memory-per-node=200MB
discovery-server.enabled=true
discovery.uri=http://namenode.selise.ch:8081

jvm.config

[root@namenode presto-server-0.164]# cat etc/jvm.config
-server
-Xmx800M
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p

node.properties

[root@namenode presto-server-0.164]# cat etc/node.properties
node.environment=dev
node.id=presto-node-cordinator
node.data-dir=/root/datap

log.properties

[root@namenode presto-server-0.164]# cat etc/log.properties
com.facebook.presto=INFO

Now you need to create a data location where you need to store the presto data. I have assigned node.data-dir=/root/datap inside node.properties.

Now you are ready to start your presto server:

[root@namenode presto-server-0.164]# ls
bin  etc  lib  NOTICE  plugin  presto  presto-cli-0.170-executable.jar  README.txt

[root@namenode presto-server-0.164]#./bin/launcher run
 separated)
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.metastore                                     thrift      thrift
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.allow-add-column                              false       false                                Allow Hive connector to add column
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.allow-drop-table                              false       false                                Allow Hive connector to drop table
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.allow-rename-column                           false       false                                Allow Hive connector to rename column
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.allow-rename-table                            false       false                                Allow Hive connector to rename table
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap       hive.security                                      legacy      legacy
2017-03-29T13:00:43.264+0600    INFO    main    Bootstrap
2017-03-29T13:00:44.572+0600    INFO    main    com.facebook.presto.metadata.StaticCatalogStore -- Added catalog hive using connector hive-hadoop2 --
2017-03-29T13:00:44.574+0600    INFO    main    com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager       -- Loading resource group configuration manager --
2017-03-29T13:00:44.575+0600    INFO    main    com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager       -- Loaded resource group configuration manager legacy --
2017-03-29T13:00:44.575+0600    INFO    main    com.facebook.presto.security.AccessControlManager       -- Loading system access control --
2017-03-29T13:00:44.575+0600    INFO    main    com.facebook.presto.security.AccessControlManager       -- Loaded system access control allow-all --
2017-03-29T13:00:44.926+0600    INFO    main    com.facebook.presto.server.PrestoServer ======== SERVER STARTED ========

Now you are ready for your single node cluster where coordinator and worker is running in a single pc.

Lets start Multi worker presto cluster

I have three worker pc which are

namenode.selise.ch
datanode1.selise.ch
datanode2.selise.ch

Then I have copied presto-server-0.164.tar.gz to my datanode1.selise.ch and datanode2.selise.ch pc and tried to configure as like as my below configuration. Please have a look on my presto worker node configuration.

[root@namenode presto-server-0.164]# scp -r ../presto-server-0.164.tar.gz datanode1.selise.ch:/home/admin

[root@namenode presto-server-0.164]# ssh datanode1.selise.ch
Last login: Mon Mar 27 14:48:46 2017 from namenode.selise.ch

[root@datanode1 ~]# cd /home/admin
[root@datanode1 admin]# tar -xvf presto-server-0.164.tar.gz
[root@datanode1 admin]# cd presto-server-0.164/

[root@datanode1 presto-server-0.164]# tree etc/
etc/
├── catalog
│   ├── hive.properties
│   └── jmx.properties
├── config.properties
├── jvm.config
├── log.properties
└── node.properties

1 directory, 6 files

config.properties

[root@datanode1 presto-server-0.164]# cat etc/config.properties
coordinator=false
http-server.http.port=8081
query.max-memory=800MB
query.max-memory-per-node=200MB
discovery.uri=http://namenode.selise.ch:8081

Here I have disabled the coordinator=false and discovery.uri is my presto coordinator pc which is my namenode.selise.ch pc.

node.properties

[root@datanode1 presto-server-0.164]# cat etc/node.properties
node.environment=dev
node.id=presto-node-1
node.data-dir=/root/datap

Now do the same things as for datanode2.selise.ch and restart the coordinator pc and try to use your shell to check every thing is working or not.

[root@namenode.selise.ch presto-server-0.164]# ./bin/launcher run
2017-03-27T13:55:06.696+0600    INFO    main    Bootstrap       hive.allow-rename-table                            false       false                                Allow Hive connector to rename table
2017-03-27T13:55:06.696+0600    INFO    main    Bootstrap       hive.security                                      legacy      legacy
2017-03-27T13:55:06.696+0600    INFO    main    Bootstrap
2017-03-27T13:55:07.456+0600    INFO    main    com.facebook.presto.metadata.StaticCatalogStore -- Added catalog hive using connector hive-hadoop2 --
2017-03-27T13:55:07.457+0600    INFO    main    com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager       -- Loading resource group configuration manager --
2017-03-27T13:55:07.459+0600    INFO    main    com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager       -- Loaded resource group configuration manager legacy --
2017-03-27T13:55:07.459+0600    INFO    main    com.facebook.presto.security.AccessControlManager       -- Loading system access control --
2017-03-27T13:55:07.459+0600    INFO    main    com.facebook.presto.security.AccessControlManager       -- Loaded system access control allow-all --
2017-03-27T13:55:07.482+0600    INFO    main    com.facebook.presto.server.PrestoServer ======== SERVER STARTED ========
[root@namenode presto-server-0.164]# ./presto --server namenode.selise.ch:8081 --catalog hive
presto> use zurich;
presto:zurich> select count(*) from parking_events_text_partition;
   _col0
-----------
 229966246
(1 row)

Query 20170327_075512_00001_hgdm2, FINISHED, 3 nodes
Splits: 1,187 total, 1,187 done (100.00%)
6:50 [230M rows, 32.3GB] [561K rows/s, 80.7MB/s]

Now you can easily see that 3 node presto cluster is ready for work. Now lets enjoy with your presto custer
will be continued ….

12 thoughts on “How to setup multi node presto cluster ?”

  1. Hello this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors
    or if you have to manually code with HTML. I’m starting a blog soon but have no coding skills
    so I wanted to get advice from someone with experience.
    Any help would be greatly appreciated!

  2. I am really loving the theme/design of your website.
    Do you ever run into any browser compatibility problems? A small number of my blog visitors have
    complained about my site not working correctly in Explorer but looks great in Opera.
    Do you have any ideas to help fix this problem?

Leave a Reply