之前我们做了Flink的开发,开发完成之后就需要进行监控。
Flink 有一个History Server可以在相关Flink 集群关闭之后,还可以查看一些信息。也就是一些作业运行完成之后,可以用History Server查看运行的统计信息。同时,还暴露了一些RestAPI,允许http进行请求。
修改配置文件conf/flink-conf.yaml
:
jobmanager.archive.fs.dir: hdfs://swarm-manager:9000/completed-jobs/
historyserver.web.address: 0.0.0.0
historyserver.web.port: 8083
historyserver.archive.fs.dir: hdfs://swarm-manager:9000/completed-jobs/
historyserver.archive.fs.refresh-interval: 10000
启动HistoryServer
浏览器中输入地址:http://swarm-manager:8083
查看HDFS中的文件:
因为还没有执行作业,所以没有生成completed-jobs文件
测试History Server
执行命令./bin/flink run -m yarn-cluster -yn 1 ./examples/batch/WordCount.jar
浏览器中输入:http://swarm-manager:8083
然后在hdfs中查看:
API
请求发送http://hostname:8083(这个在配置文件中设置的)/jobs
URI:
- /config
- /jobs/overview
- /jobs/< jobid>
- /jobs/< jobid>/vertices
- /jobs/< jobid>/config
- /jobs/< jobid>/exceptions
- /jobs/< jobid>/accumulators
- /jobs/< jobid>/vertices/< vertexid>
- /jobs/< jobid>/vertices/< vertexid>/subtasktimes
- /jobs/< jobid>/vertices/< vertexid>/taskmanagers
- /jobs/< jobid>/vertices/< vertexid>/accumulators
- /jobs/< jobid>/vertices/< vertexid>/subtasks/accumulators
- /jobs/< jobid>/vertices/< vertexid>/subtasks/< subtasknum>
- /jobs/< jobid>/vertices/< vertexid>/subtasks/< subtasknum>/attempts/< attempt>
- /jobs/< jobid>/vertices/< vertexid>/subtasks/< subtasknum>/attempts/< attempt>/accumulators
- /jobs/< jobid>/plan
例如: http://hostname:port/jobs/7684be6004e4e955c2a558a9bc463f65/exceptions