从Spark 2.2.0开始,API中提供了新的端点来获取有关流作业的信息。
我在群集模式下使用Spark 2.2.0在EMR群集上运行Spark。
当我为我的流作业找到端点时,它给我的只是错误消息:
没有附加到<stream name>的流侦听器
我已经稍微研究了一下Spark代码库,但是该功能的文档记录不是很好。所以我很好奇这是一个错误吗?我需要做一些配置才能使此端点正常工作吗?
特别是在群集上运行时,这似乎是一个问题。在本地计算机上的Spark 2.2.0上运行的相同代码显示了预期的统计信息,但是在群集上运行时给出了该错误消息。
我正在使用从master(即YMMV)那里构建的最新的Spark 2.3.0-SNAPSHOT。工作正常。
我需要做一些配置才能使此端点正常工作吗?
否。在不更改默认配置的情况下应该可以正常工作。
确保您使用了驱动程序的主机和端口(有传言说您也可以访问18080
Spark History Server,它确实显示了所有相同的终结点和正在运行的相同作业,但未附加流侦听器)。
如您在源代码中所看到的那样,错误消息仅在ui.getStreamingJobProgressListener
未注册的地方(以结尾case None
)会存在。
那么现在的问题是,为什么SparkListener
不注册呢?
这使我们的streamingJobProgressListener VAR正在使用set setStreamingJobProgressListener方法完全而StreamingTab
被实例化(这是为什么我要你的理由,如果你能看到的流标签)。
换句话说,如果您在Web UI中看到“流”选项卡,则可以使用流指标的端点。检查指向端点的URL,其格式应为:
http://[driverHost]:[port]/api/v1/applications/[appId]/streaming/statistics
我试图重现您的案子,并通过以下步骤使我想到了一个可行的案子。
开始了Spark Streaming应用程序的官方示例之一。
$ ./bin/run-example streaming.StatefulNetworkWordCount localhost 9999
我确实nc -lk 9999
先跑步了。
打开Web UI @ http:// localhost:4040 / streaming以确保“ Streaming”选项卡在那里。
确保http:// localhost:4040 / api / v1 / applications /使用应用程序ID进行响应。
$ http http://localhost:4040/api/v1/applications/
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Length: 266
Content-Type: application/json
Date: Wed, 13 Dec 2017 07:58:04 GMT
Server: Jetty(9.3.z-SNAPSHOT)
Vary: Accept-Encoding, User-Agent
[
{
"attempts": [
{
"appSparkVersion": "2.3.0-SNAPSHOT",
"completed": false,
"duration": 0,
"endTime": "1969-12-31T23:59:59.999GMT",
"endTimeEpoch": -1,
"lastUpdated": "2017-12-13T07:53:53.751GMT",
"lastUpdatedEpoch": 1513151633751,
"sparkUser": "jacek",
"startTime": "2017-12-13T07:53:53.751GMT",
"startTimeEpoch": 1513151633751
}
],
"id": "local-1513151634282",
"name": "StatefulNetworkWordCount"
}
]
访问了Spark Streaming应用程序的端点@ http:// localhost:4040 / api / v1 / applications / local-1513151634282 / streaming / statistics。
$ http http://localhost:4040/api/v1/applications/local-1513151634282/streaming/statistics
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Length: 219
Content-Type: application/json
Date: Wed, 13 Dec 2017 08:00:10 GMT
Server: Jetty(9.3.z-SNAPSHOT)
Vary: Accept-Encoding, User-Agent
{
"avgInputRate": 0.0,
"avgProcessingTime": 30,
"avgSchedulingDelay": 0,
"avgTotalDelay": 30,
"batchDuration": 1000,
"numActiveBatches": 0,
"numActiveReceivers": 1,
"numInactiveReceivers": 0,
"numProcessedRecords": 0,
"numReceivedRecords": 0,
"numReceivers": 1,
"numRetainedCompletedBatches": 376,
"numTotalCompletedBatches": 376,
"startTime": "2017-12-13T07:53:54.921GMT"
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句