Centos 6.9 配置 Presto

1. 解压缩 presto-server-0.166.tar.gz

tar -xzvf presto-server-0.166.tar.gz

2. 在 presto-server-0.166 目录下创建 etc 目录

cd presto-server-0.166
mkdir etc

3. 在 etc 目录下创建 catalog 目录

cd etc
mkdir catalog

4. 在 catalog 目录下创建文件 hive.properties ,文件内容如下

connector.name=hive-hadoop2
hive.metastore.uri=thrift://bigdata:9083
hive.config.resources=/opt/hadoop-2.7.4/etc/hadoop/core-site.xml,/opt/hadoop-2.7.4/etc/hadoop/hdfs-site.xml

5. 在 etc 目录下创建 config.properties , 文件内容如下

coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=512MB
query.max-memory-per-node=512MB
discovery-server.enabled=true
discovery.uri=http://bigdata:8080

6. 在 etc 目录下创建 jvm.config , 文件内容如下

-server
-Xmx1G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:OnOutOfMemoryError=kill -9 %p

7. 在 etc 目录下创建 node.properties , 文件内容如下

node.environment=production
node.id=bigdata
node.data-dir=/opt/presto-server-0.166/presto_data

8. 配置 presto client

# 把客户端jar包放置在presto-server-0.166/bin目录下
mv presto-cli-0.166-executable.jar presto-server-0.166/bin
# 修改客户端jar包名为presto
mv presto-cli-0.166-executable.jar presto
# 修改presto客户端jar包权限
chmod +x presto

9. 把 presto 添加到环境变量中 (~/.bash_profile)

export PRESTO_HOME=/opt/presto-server-0.166
export PATH=$PRESTO_HOME/bin:$PATH
# 使环境变量立即生效
source ~/.bash_profile

10. 启动 Presto

presto 依赖 hdfs 和 hive metastore

# 启动 HDFS
hadoop-2.7.4/sbin/start-dfs.sh
# 启动 Hive metastore
sudo service mysqld start
nohup hive --service metastore >> /opt/apache-hive-2.1.1-bin/metastore.log 2>&1 &
# 启动 Presto
presto-server-0.166/bin/launcher start

11. 验证 presto 是否启动

查看Presto Web UI

http://bigdata:8080

启动 Presto 客户端

presto --server bigdata:8080 --catalog hive --schema default

猜你喜欢

转载自my.oschina.net/u/1411151/blog/1630003