您的位置:首页 > 其它

Flink Rest API使用

2018-05-29 19:28 429 查看

Flink Rest API使用

1. 上传jar包接口

  • 请求方式

      POST
  • 请求参数

      设置请求头 application/java-archive
  • 返回结果

    {
    "status": "success",
    "filename": "d750fe29-7d5b-404f-a984-d0690f35ea6e_flink-4.jar"
    }
  • 请求实例



  • 2. 提交任务接口

  • 请求方式

      POST
  • 请求参数

      entry-class 程序入口类
    • program-args 运行程序所需参数
  • 返回结果

    {
    jobid: "56a616094e87e3f2d6ac9a4ce9e065f7"
    }
  • 请求示例http://hadoop3.test.yunwei.puppet.dh:40610/jars/069bd150-a79c-4417-aa3c-d1b2e447bb43_flink.jar/run?entry-class=com.dianhun.flinkstreaming.CommonKafkaTable&program-args=--bootstrap.servers hadoop2.test.yunwei.puppet.dh:6667,hadoop3.test.yunwei.puppet.dh:6667,hadoop4.test.yunwei.puppet.dh:6667 --group.id m3gcn_tab_map_race_3 --client.id m3gcn_tab_map_race_3 --config.file hdfs://DHTestCluster/user/gezhihui/flink/configuration/m3gcn_tab_map_race2.txt --job.name m3gcn_tab_map_race




  • 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
    }
    }
    ]
    }
  • 请求示例

  • http://hadoop3.test.yunwei.puppet.dh:40610/joboverview



    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": {} } ] } }

    • 请求示例

    http://hadoop3.test.yunwei.puppet.dh:40610/jobs/56a616094e87e3f2d6ac9a4ce9e065f7



    7. 查看某个job的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 } ] }

    • 请求示例

    http://hadoop3.test.yunwei.puppet.dh:40610/jobs/56a616094e87e3f2d6ac9a4ce9e065f7/checkpoints

    8. 取消某个job

  • 请求方式

      GET
  • 请求参数

  • 返回结果

  • {}

    • 请求示例

    http://hadoop3.test.yunwei.puppet.dh:40610/jobs/56a616094e87e3f2d6ac9a4ce9e065f7/cancel



    9.删除某个jar包

  • 请求方式

      DELETE
  • 请求参数

  • 返回结果

  • {}

    • 请求示例

    http://hadoop3.test.yunwei.puppet.dh:40610/jars/99e089eb-b686-4029-a8cb-bbc2ff13ec7c_flink.jar


    阅读更多
    内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
    标签: