presto-gateway is lyft team open source prestodb tools. The following is a simple trial, and the solution to the problem encountered
there is the mirror image of the production docker
Dockerfile
Very simple, based on local building and jdk base image, make docker mirror
- Construction method
Because the default when running in the official index of the emergence of a bug (mainly because of treatment-induced state api), so using my own version
git clone https://github.com/rongfengliang/presto-gateway.git
cd soon - gateway
mvn clean pacakge
- Dockerfile
FROM azul/zulu-openjdk-alpine:8u222
LABEL AUTHOR="dalongrong"
LABEL EMAIL="[email protected]"
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"]
Integrated gateway trial
- docker-compose documents
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 configuration file
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 calls
For ease of use, modify the existing nodejs of a presto client support presto-gateway
- Code
var soon = require ( '@ dalongrong / early-client');
var client = new soon. Client ({
user: 'appdemo',
host: "localhost",
port: 8888
});
client.execute({
query: 'select * from nation2',
catalog: 'memory',
schema: 'default',
Source: 'nodejs-customer'
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)
}
});
Access interface effects
Explanation
For can refer to the official document, the official screenshots present a problem, but presto-gateway is a great tool, we can simplify the administration for the presto
Reference material
https://github.com/rongfengliang/presto-gateway
https://github.com/rongfengliang/presto-client-node
https://github.com/lyft/presto-gateway