【问题标题】:Presto Query through ELB error "The plain HTTP request was sent to HTTPS"Presto Query 通过 ELB 报错“The plain HTTP request was sent to HTTPS”
【发布时间】:2019-04-23 11:40:06
【问题描述】:

当使用带有 HTTPS 侦听器的 AWS ELB(弹性负载均衡器)将请求转发到在 HTTP 上运行的 presto 集群 (0.193) 时,使用 presto-jdbc (0.213) 的 Java 客户端无法执行选择查询,因为“普通 HTTP 请求已发送到 HTTPS 端口”错误。

Exception in thread "main" java.sql.SQLException: Error executing query
    at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:274)
    at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:227)
    at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:76)
    at com.DpTool.executeJdbcQuerySsl(DpTool.java:332)
    at com.DpTool.prestoJdbcSsl(DpTool.java:315)
    at com.DpTool.main(DpTool.java:520)
Caused by: java.lang.RuntimeException: Error fetching next at http://cluster-elb.mydomain:8443/v1/statement/20181120_215602_00038_57ryf/1 returned an invalid response: JsonResponse{statusCode=400, statusMessage=Bad Request, headers={connection=[close], content-length=[236], content-type=[text/html], date=[Tue, 20 Nov 2018 21:56:02 GMT], server=[awselb/2.0]}, hasValue=false} [Error: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>
]
    at com.facebook.presto.jdbc.internal.client.StatementClientV1.requestFailedException(StatementClientV1.java:436)
    at com.facebook.presto.jdbc.internal.client.StatementClientV1.advance(StatementClientV1.java:383)
    at com.facebook.presto.jdbc.PrestoResultSet.getColumns(PrestoResultSet.java:1742)
    at com.facebook.presto.jdbc.PrestoResultSet.<init>(PrestoResultSet.java:119)
    at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:249)
    ... 5 more

StatementClientV1.advance 代码似乎尝试访问 ELB 地址“http://cluster-elb.mydomain:8443/...”,但它应该是“https”而不是“http”前缀。当直接对另一个 HTTPS presto 集群(无 ELB)执行查询时,相同的客户端代码可以正常工作。这是客户端 Java 代码。 url 是“cluster-elb.mydomain:8443”

Properties properties = new Properties();
properties.setProperty("SSL", "true");
Connection conn = DriverManager.getConnection(url, properties);
Statement stmt = conn.createStatement();
String query = "select cluster, query_text from mytable where ds='2018-10-20' limit 10";
ResultSet rs = stmt.executeQuery(query);

presto-jdbc 客户端代码为什么会混淆,如何让查询工作?

【问题讨论】:

    标签: amazon-elb presto


    【解决方案1】:

    这应该适用于较新版本的 Presto。用 0.213 试试吧。

    【讨论】:

    • 我还不能快速尝试 0.213,因为 Qubole presto 集群是 0.193(并且好像它是最新版本的 Qubole 支持)。您是否有相关提交或其他上下文的参考以供审查和潜在的挑选?
    • @danzhi 0.193 已经很老了。我强烈建议升级。或者,您可以使用 presto-proxy 终止 TLS。顺便说一句,您可以在 Qubole 平台上应用自定义补丁吗?
    【解决方案2】:

    问题是由于https://github.com/prestodb/presto/issues/8232 QueryStatusInfo 中的 nextUri 字段被 presto 服务器错误地设置为 http 而不是 https(当客户端通过 elb 或代理与 presto 通信时)。

    【讨论】:

    • 这个问题很久以前就修复了。相关更改已关闭,但附加问题未关闭。我已经关闭了这个问题。
    猜你喜欢
    • 2023-04-03
    • 2021-03-23
    • 2018-10-24
    • 2020-08-22
    • 2016-05-19
    • 1970-01-01
    • 2022-10-16
    • 1970-01-01
    • 2020-11-16
    相关资源
    最近更新 更多