节点资源¶
- GET /v1/node()¶
返回 Presto 服务器已知的节点列表。此调用不需要查询参数或标头,它只返回 Presto 安装中每个已知节点的数组。
在响应中,
recentRequests
、recentFailures
和recentSuccesses
的值是衰减计数器,设置为随时间呈指数衰减,衰减参数为 1 分钟。这种衰减率意味着,如果 Presto 节点在几秒内有 1000 次成功,此统计值将在 1 分钟内下降到 367。age
显示特定节点已运行的时间,uri 指向特定节点的 HTTP 服务器。最后请求和最后响应时间显示节点最近使用的时间。以下示例响应显示一个没有经历任何故障条件的单个节点。每个节点还报告有关流量正常运行时间和故障的统计信息。
示例响应:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript [ { "uri":"http://10.209.57.156:8080", "recentRequests":25.181940555111073, "recentFailures":0.0, "recentSuccesses":25.195472984170983, "lastRequestTime":"2013-12-22T13:32:44.673-05:00", "lastResponseTime":"2013-12-22T13:32:44.677-05:00", "age":"14155.28ms", "recentFailureRatio":0.0, "recentFailuresByType":{} } ]
如果节点正在遇到错误,您将看到类似于以下内容的响应。在这里,我们有一个节点,它经历了一系列错误。recentFailuresByType 字段列出了最近在特定节点上发生的 Java 异常。
带有错误的示例响应:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript [ { "age": "4.45m", "lastFailureInfo": { "message": "Connect Timeout", "stack": [ "org.eclipse.jetty.io.ManagedSelector$ConnectTimeout.run(ManagedSelector.java:683)", .... "java.lang.Thread.run(Thread.java:745)" ], "suppressed": [], "type": "java.net.SocketTimeoutException" }, "lastRequestTime": "2017-08-05T11:53:00.647Z", "lastResponseTime": "2017-08-05T11:53:00.647Z", "recentFailureRatio": 0.47263053472046446, "recentFailures": 2.8445543205610617, "recentFailuresByType": { "java.net.SocketTimeoutException": 2.8445543205610617 }, "recentRequests": 6.018558073577414, "recentSuccesses": 3.1746446343010297, "uri": "http://172.19.0.3:8080" } ]
- GET /v1/node/failed()¶
调用此服务将返回一个 JSON 文档,其中列出了所有在最后一次心跳检查中失败的节点。此调用返回的信息与先前服务返回的信息相同。
示例响应:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript [ { "age": "1.37m", "lastFailureInfo": { "message": "Connect Timeout", "stack": [ "org.eclipse.jetty.io.ManagedSelector$ConnectTimeout.run(ManagedSelector.java:683)", .... "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)", "java.lang.Thread.run(Thread.java:745)" ], "suppressed": [], "type": "java.net.SocketTimeoutException" }, "lastRequestTime": "2017-08-05T11:52:42.647Z", "lastResponseTime": "2017-08-05T11:52:42.647Z", "recentFailureRatio": 0.22498784153043677, "recentFailures": 20.11558290058638, "recentFailuresByType": { "java.net.SocketTimeoutException": 20.11558290058638 }, "recentRequests": 89.40742203558189, "recentSuccesses": 69.30583024727453, "uri": "http://172.19.0.3:8080" } ]