一. 环境介绍
三台主机,主机名和ip分别为:
ubuntu1 10.3.19.171
ubuntu2 10.3.19.172
ubuntu3 10.3.19.173
三台主机的登录用户名是bigdata,home目录是/home/bigdata
现在三台主机上部署presto集群。其中ubuntu1作为coordinator,ubuntu2 ubuntu3作为worker。
下载presto地址:
wget http://maven.aliyun.com/nexus/content/groups/public/com/facebook/presto/presto-server/0.173/presto-server-0.173.tar.gz
jdk版本如下,presto-server-0.173.tar.gz需要jdk版本1.8.0_60或以上
bigdata@ubuntu1:~$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
二.安装
bigdata@ubuntu1:~/download$ tar -zxvf presto-server-0.173.tar.gz
bigdata@ubuntu1:~/download$ mv presto-server-0.173 ../run/
bigdata@ubuntu1:~/download$ cd ../run/
bigdata@ubuntu1:~/run$ ln -s presto-server-0.173 presto
三. 配置presto
在presto目录下创建etc目录,并在etc目录下,执行如下命令:
bigdata@ubuntu1:~/run/presto/etc$ touch node.properties jvm.config config.properties log.properties
bigdata@ubuntu1:~/run/presto/etc$ mkdir catalog
bigdata@ubuntu1:~/run/presto/etc$ touch catalog/jmx.properties
创建如下文件
node.properties :每个节点的环境配置
jvm.config :jvm 参数
config.properties :配置 Presto Server 参数
log.properties :配置日志等级
Catalog Properties :Catalog 的配置
node.properties
bigdata@ubuntu1:~/run/presto/etc$ cat node.properties
node.environment=bigdata_prosto_cluster
node.id=bigdata_node_coordinator_ubuntu1
node.data-dir=/home/bigdata/run/presto/data
jvm.config
bigdata@ubuntu1:~/run/presto/etc$ cat jvm.config
-server
-Xmx1G
-XX:+UseConcMarkSweepGC
-XX:+ExplicitGCInvokesConcurrent
-XX:+CMSClassUnloadingEnabled
-XX:+AggressiveOpts
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p
-XX:ReservedCodeCacheSize=150M
config.properties
bigdata@ubuntu1:~/run/presto/etc$ cat config.properties
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=18080
#task.max-memory=8GB
discovery-server.enabled=true
discovery.uri=http://ubuntu1:18080
log.properties
bigdata@ubuntu1:~/run/presto/etc$ cat log.properties
com.facebook.presto=INFO
Catalog Properties
bigdata@ubuntu1:~/run/presto/etc$ cat catalog/jmx.properties
connector.name=jmx
以上是单机部署presto, 至此已经完成。
四. 在单机基础上集群部署presto
为了部署方便,直接将ubuntu1上的presto打包,拷贝到ubuntu2 ubuntu3主机上
bigdata@ubuntu1:~/run$ tar -zcvf presto-server-0.173.tar.gz presto-server-0.173/
bigdata@ubuntu1:~/run$ scp presto-server-0.173.tar.gz ubuntu2:/home/bigdata/run/
presto-server-0.173.tar.gz 100% 391MB 27.9MB/s 00:14
bigdata@ubuntu1:~/run$ scp presto-server-0.173.tar.gz ubuntu3:/home/bigdata/run/
presto-server-0.173.tar.gz 100% 391MB 35.5MB/s 00:
修改ubuntu2和ubuntu3上的配置文件
修改ubuntu2上config.properties,内容如下:
bigdata@ubuntu2:~/run/presto/etc$ cat config.properties
coordinator=false
http-server.http.port=18080
query.max-memory=1GB
discovery.uri=http://ubuntu1:18080
修改ubuntu2上
node.properties,内容如下:
bigdata@ubuntu2:~/run/presto/etc$ cat node.properties
node.environment=bigdata_prosto_cluster
node.id=bigdata_node_worker_ubuntu2
node.data-dir=/home/bigdata/run/presto/data
修改ubuntu3上config.properties,内容如下:
bigdata@ubuntu3:~/run/presto/etc$ cat config.properties
coordinator=false
http-server.http.port=18080
query.max-memory=1GB
discovery.uri=http://ubuntu1:18080修改ubuntu3上node.properties,内容如下:
bigdata@ubuntu2:~/run/presto/etc$ cat node.properties
node.environment=bigdata_prosto_cluster
node.id=bigdata_node_worker_ubuntu3
node.data-dir=/home/bigdata/run/presto/data
至此presto集群部署完毕。
五. 启动presto
在ubuntu1 ubuntu2 ubuntu3上分别执行启动命令
bigdata@ubuntu1:~/run/presto/bin$ ./launcher start
Started as 3122
六.访问页面
访问http://10.3.19.171:18080,展示如下:
七. 测试presto
参考:http://www.cnblogs.com/tgzhu/p/6038123.html