Flink Rest API使用
Flink Rest API使用
1. 上传jar包接口
请求方式
- POST
请求参数
- 设置请求头 application/java-archive
返回结果
{ "status": "success", "filename": "d750fe29-7d5b-404f-a984-d0690f35ea6e_flink-4.jar" }
2. 提交任务接口
请求路径
http://hadoop3.test.yunwei.puppet.dh:40610/jars//run?entry-class=xxxx&program-args=xxxx
请求方式
- POST
请求参数
- entry-class 程序入口类
返回结果
{ jobid: "56a616094e87e3f2d6ac9a4ce9e065f7" }
3. 查看所有的job
请求方式
- GET
请求参数
- 无
返回结果
{ "running": [ { "jid": "56a616094e87e3f2d6ac9a4ce9e065f7", "name": "m3gcn_tab_map_race", "state": "RUNNING", "start-time": 1527581677307, "end-time": -1, "duration": 925176, "last-modification": 1527581677325, "tasks": { "total": 2, "pending": 0, "running": 2, "finished": 0, "canceling": 0, "canceled": 0, "failed": 0 } } ], "finished": [ { "jid": "9887b83b7aa8b37afd5910afb0863096", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527580382672, "end-time": 1527580438760, "duration": 56088, "last-modification": 1527580438760, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "27d8546382f99175a0274ca2664e783c", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527580881067, "end-time": 1527581077433, "duration": 196366, "last-modification": 1527581077433, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "38d2fabb0e961851bb093aae3732c1a9", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581064439, "end-time": 1527581082420, "duration": 17981, "last-modification": 1527581082420, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "05ba8289a3d54a466651b2396e76c79f", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581106643, "end-time": 1527581143190, "duration": 36547, "last-modification": 1527581143190, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "e03b5a5dae2222da058c89f3c76f361f", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581125521, "end-time": 1527581148989, "duration": 23468, "last-modification": 1527581148989, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } } ] }
4. 查看运行中job
请求方式
- GET
请求参数
- 无
返回结果
{ "jobs": [ { "jid": "56a616094e87e3f2d6ac9a4ce9e065f7", "name": "m3gcn_tab_map_race", "state": "RUNNING", "start-time": 1527581677307, "end-time": -1, "duration": 1406337, "last-modification": 1527581677325, "tasks": { "total": 2, "pending": 0, "running": 2, "finished": 0, "canceling": 0, "canceled": 0, "failed": 0 } } ] }
请求示例
http://hadoop3.test.yunwei.puppet.dh:40610/joboverview/running
5. 查看完成的job
请求方式
- GET
请求参数
- 无
返回结果
{ "jobs": [ { "jid": "9887b83b7aa8b37afd5910afb0863096", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527580382672, "end-time": 1527580438760, "duration": 56088, "last-modification": 1527580438760, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "27d8546382f99175a0274ca2664e783c", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527580881067, "end-time": 1527581077433, "duration": 196366, "last-modification": 1527581077433, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "38d2fabb0e961851bb093aae3732c1a9", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581064439, "end-time": 1527581082420, "duration": 17981, "last-modification": 1527581082420, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "05ba8289a3d54a466651b2396e76c79f", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581106643, "end-time": 1527581143190, "duration": 36547, "last-modification": 1527581143190, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } }, { "jid": "e03b5a5dae2222da058c89f3c76f361f", "name": "m3gcn_tab_map_race", "state": "CANCELED", "start-time": 1527581125521, "end-time": 1527581148989, "duration": 23468, "last-modification": 1527581148989, "tasks": { "total": 2, "pending": 0, "running": 0, "finished": 0, "canceling": 0, "canceled": 2, "failed": 0 } } ] }
请求示例
http://hadoop3.test.yunwei.puppet.dh:40610/joboverview/completed
6. 查看某个job的详情
请求方式
- GET
请求参数
- 无
返回结果
{ "jid": "56a616094e87e3f2d6ac9a4ce9e065f7", "name": "m3gcn_tab_map_race", "isStoppable": false, "state": "RUNNING", "start-time": 1527581677307, "end-time": -1, "duration": 2852394, "now": 1527584529701, "timestamps": { "CREATED": 1527581677307, "RUNNING": 1527581677309, "FAILING": 0, "FAILED": 0, "CANCELLING": 0, "CANCELED": 0, "FINISHED": 0, "RESTARTING": 0, "SUSPENDED": 0, "RECONCILING": 0 }, "vertices": [ { "id": "cbc357ccb763df2852fee8c4fc7d55f2", "name": "Source: Custom Source -> Map -> Filter", "parallelism": 1, "status": "RUNNING", "start-time": 1527581677310, "end-time": -1, "duration": 2852391, "tasks": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 1, "FINISHED": 0, "CANCELING": 0, "CANCELED": 0, "FAILED": 0, "RECONCILING": 0 }, "metrics": { "read-bytes": 0, "write-bytes": 29946, "read-records": 0, "write-records": 0 } }, { "id": "c27dcf7b54ef6bfd6cff02ca8870b681", "name": "Keyed Reduce -> Map -> Sink: MySQLSink", "parallelism": 1, "status": "RUNNING", "start-time": 1527581677311, "end-time": -1, "duration": 2852390, "tasks": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 1, "FINISHED": 0, "CANCELING": 0, "CANCELED": 0, "FAILED": 0, "RECONCILING": 0 }, "metrics": { "read-bytes": 31074, "write-bytes": 0, "read-records": 0, "write-records": 0 } } ], "status-counts": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 2, "FINISHED": 0, "CANCELING": 0, "CANCELED": 0, "FAILED": 0, "RECONCILING": 0 }, "plan": { "jid": "56a616094e87e3f2d6ac9a4ce9e065f7", "name": "m3gcn_tab_map_race", "nodes": [ { "id": "c27dcf7b54ef6bfd6cff02ca8870b681", "parallelism": 1, "operator": "", "operator_strategy": "", "description": "Keyed Reduce -> Map -> Sink: MySQLSink", "inputs": [ { "num": 0, "id": "cbc357ccb763df2852fee8c4fc7d55f2", "ship_strategy": "HASH", "exchange": "pipelined_bounded" } ], "optimizer_properties": {} }, { "id": "cbc357ccb763df2852fee8c4fc7d55f2", "parallelism": 1, "operator": "", "operator_strategy": "", "description": "Source: Custom Source -> Map -> Filter", "optimizer_properties": {} } ] } }
请求示例
7. 查看某个job的checkpoints
请求路径
http://hadoop3.test.yunwei.puppet.dh:40610/jobs//checkpoints
请求方式
- GET
请求参数
- 无
返回结果
{ "counts": { "restored": 0, "total": 52, "in_progress": 0, "completed": 52, "failed": 0 }, "summary": { "state_size": { "min": 6579, "max": 6579, "avg": 6579 }, "end_to_end_duration": { "min": 99, "max": 248, "avg": 127 }, "alignment_buffered": { "min": 0, "max": 0, "avg": 0 } }, "latest": { "completed": { "id": 52, "trigger_timestamp": 1527584797309, "latest_ack_timestamp": 1527584797434, "state_size": 6579, "end_to_end_duration": 125, "alignment_buffered": 0, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-7af7956db949" } }, "history": [ { "id": 52, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584797309, "latest_ack_timestamp": 1527584797434, "state_size": 6579, "end_to_end_duration": 125, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-7af7956db949", "discarded": false }, { "id": 51, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584737309, "latest_ack_timestamp": 1527584737427, "state_size": 6579, "end_to_end_duration": 118, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-3884d96002bb", "discarded": true }, { "id": 50, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584677309, "latest_ack_timestamp": 1527584677432, "state_size": 6579, "end_to_end_duration": 123, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-834d31836064", "discarded": true }, { "id": 49, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584617309, "latest_ack_timestamp": 1527584617433, "state_size": 6579, "end_to_end_duration": 124, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-00a47580a3b9", "discarded": true }, { "id": 48, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584557309, "latest_ack_timestamp": 1527584557434, "state_size": 6579, "end_to_end_duration": 125, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-bb25b032de41", "discarded": true }, { "id": 47, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584497309, "latest_ack_timestamp": 1527584497424, "state_size": 6579, "end_to_end_duration": 115, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-46fce2fbb964", "discarded": true }, { "id": 46, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584437309, "latest_ack_timestamp": 1527584437441, "state_size": 6579, "end_to_end_duration": 132, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-7560298b6d10", "discarded": true }, { "id": 45, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584377309, "latest_ack_timestamp": 1527584377442, "state_size": 6579, "end_to_end_duration": 133, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-79fa60e9c686", "discarded": true }, { "id": 44, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584317309, "latest_ack_timestamp": 1527584317423, "state_size": 6579, "end_to_end_duration": 114, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-0185033fdfdd", "discarded": true }, { "id": 43, "status": "COMPLETED", "is_savepoint": false, "trigger_timestamp": 1527584257309, "latest_ack_timestamp": 1527584257428, "state_size": 6579, "end_to_end_duration": 119, "alignment_buffered": 0, "num_subtasks": 2, "num_acknowledged_subtasks": 2, "external_path": "hdfs://DHTestCluster/user/gezhihui/flink/savepoint/checkpoint_metadata-34c020f82fbc", "discarded": true } ] }
请求示例
8. 取消某个job
请求方式
- GET
请求参数
- 无
返回结果
{}
请求示例
9.删除某个jar包
请求方式
- DELETE
请求参数
- 无
返回结果
{}
请求示例
- 使用PHP创建一个REST API(Create a REST API with PHP)节选6
- REST API: 该使用部分更新还是全部更新?
- 百度语音识别REST API——通过使用Http网络请求方式获得语音识别功能
- SharePoint 2013 Search REST API 使用示例
- 第8章-使用Express.js和Hapi构建Node.js-REST-API服务-8.1.REST(表述性状态传递)Representational State Transfer
- Java - 在WebService中使用Client调用三方的RestAPI
- 使用Django rest framework api时,客户端返回结果为html标签
- php 使用 restler 框架构建 restfull api
- ArcGIS API for javascript开发笔记(六)——REST详解及如何使用REST API调用GP服务
- C# Redmine Rest API使用经验
- 使用Azure REST API创建虚拟机
- 第8章-使用Express.js和Hapi构建Node.js-REST-API服务-8.2.项目依赖
- 一个简单的语音识别实现---百度在线语音识别REST API SDK(Python)简单使用
- 简单C# MVC 通信录,使用REST API 应用到 Azure (有源码)
- ArcGIS API for javascript开发笔记(六)——REST详解及如何使用REST API调用GP服务
- Flink DataSet API 使用示范
- 使用Hive Rest API 连接HDInsight
- wp rest api 授权方法步骤(使用JWT Authentication插件)
- Ambari Rest api 使用