presto-gateway 试用以及docker 镜像制作
presto-gateway 是 lyft 团队开源 的prestodb 的工具.以下是一个简单的试用,以及碰到问题的解决
还有就是docker 镜像的制作
Dockerfile
很简单,本地构建然后基于jdk 基础镜像,制作docker 镜像
- 构建方法
因为默认官方在运行的时候出现了一个索引的bug(主要是因为api 状态处理引起的),所以使用了我自己的版本
git clone https://github.com/rongfengliang/presto-gateway.git
cd presto-gateway
mvn clean pacakge
- Dockerfile
FROM azul/zulu-openjdk-alpine:8u222
LABEL AUTHOR="dalongrong"
LABEL EMAIL="1141591465@qq.com"
LABEL VERSION="1.6.1"
WORKDIR /
COPY gateway/target/gateway-1.6.1-jar-with-dependencies.jar /gateway.jar
COPY config.yml.template /config.yml.template
COPY entrtypoint.sh /entrtypoint.sh
RUN chmod +x /entrtypoint.sh
EXPOSE 8888
ENTRYPOINT [ "/entrtypoint.sh"]
集成gateway 试用
- docker-compose 文件
version: "3"
services:
proxy:
image: dalongrong/presto-gateway:1.6.1
ports:
- "8888:8888"
- "8082:8082"
- "8083:8083"
build: ./
volumes:
- "./config.yml.template:/config.yml.template"
presto1:
image: starburstdata/presto
ports:
- "8080:8080"
presto2:
image: starburstdata/presto
ports:
- "8081:8080"
- proxy 配置文件
requestRouter:
port: 8888
name: prestoRouter
cacheDir: /var/log/prestoproxy/cache
historySize: 1000
backends:
- localPort: 8082
name: presto1
proxyTo: http://presto1:8080
routingGroup: adhoc
- localPort: 8083
name: presto2
proxyTo: http://presto2:8080
routingGroup: scheduled
server:
applicationConnectors:
- type: http
port: 8090
adminConnectors:
- type: http
port: 8091
notifier:
smtpHost: localhost
smtpPort: 587
sender: presto-gw-monitor-noreply@lyft.com
recipients:
- prestodev@yourorg.com
modules:
- com.lyft.data.gateway.module.ProxyBackendProviderModule
- com.lyft.data.gateway.module.GatewayProviderModule
- com.lyft.data.gateway.module.NotifierModule
managedApps:
- com.lyft.data.gateway.GatewayManagedApp
- com.lyft.data.gateway.ActiveClusterMonitor
# Logging settings.
logging:
# The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
level: INFO
# Logger-specific levels.
loggers:
com.lyft: DEBUG
appenders:
- type: console
- type: file
currentLogFilename: /var/log/prestoproxy/prestoproxy-java.log
archivedLogFilenamePattern: /var/log/prestoproxy/prestoproxy-java-%d{yyyy-MM-dd}-%i.log.gz
archivedFileCount: 7
timeZone: UTC
maxFileSize: 100MB
nodejs client 调用
为了使用方便,修改了一现有nodejs 的presto client 支持presto-gateway
- 代码
var presto = require('@dalongrong/presto-client');
var client = new presto.Client({
user: 'appdemo',
host: "localhost",
port: 8888
});
client.execute({
query: 'select * from nation2',
catalog: 'memory',
schema: 'default',
source: 'nodejs-client',
routingGroup: 'scheduled',
state: function (error, query_id, stats) {
console.log(error)
console.log({
message: "status changed",
id: query_id,
stats: stats
});
},
columns: function (error, data) {
console.log({
resultColumns: data
});
},
data: function (error, data, columns, stats) {
console.log(data);
},
success: function (error, stats) {
console.log(stats)
},
error: function (error) {
console.log(error)
}
});
访问界面效果
说明
对于使用可以参考官方文档,官方的截图目前有点问题,但是presto-gateway是一个很不错的工具,可以简化我们对于presto 的管理
参考资料
https://github.com/rongfengliang/presto-gateway
https://github.com/rongfengliang/presto-client-node
https://github.com/lyft/presto-gateway
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2018-08-24 ory Oathkeeper cloud native 访问认证平台
2018-08-24 golang 自定义importpath