尝试使用上载的jar启动新作业时发生Flink REST API POST错误

时间:2019-11-12 22:05:35

标签: apache-flink flink-streaming

在阅读完此/jars/:jarid/run-

之后,我试图按SO post端点启动Flink作业,如下所示
curl -k -v -X POST -H "Content-Type: application/json" --data '
{
    "programArgsList": [
        "--runner",
        "FlinkRunner",
        "--inputTopicName",
        "inputTopicNameValue",
        "--Argument",
        "Value",
        "--streaming",
        "true"]
}
' http://<JobManager-hostname>:<port>/jars/MyApplication.jar/run

尝试上述命令时出现以下错误-

{"errors":["Internal server error.","<Exception on server side:\norg.apache.flink.client.program.ProgramInvocationException: The main method 
caused an error: Argument 'FlinkRunner' does not begin with '--'\n\tat 
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:546)\n\tat 
org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)\n\tat 
org.apache.flink.client.program.OptimizerPlanEnvironment.getOptimizedPlan(OptimizerPlanEnvironment.java:83)\n\tat 
org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:80)

Argument 'FlinkRunner' does not begin with '--'使我认为在示例中未正确提供参数值。我了解Flink文档提供JSON模式定义,而不提供REST API docs中的示例请求。提供参数值的正确方法是什么?我的示例遵循此post中所建议的解决方案。

1 个答案:

答案 0 :(得分:0)

以下POST请求对我有用,因此我在此处进行记录-

curl -k -v -X POST -H "Content-Type: application/json" --data '
{
    "programArgsList": [
        "--runner=FlinkRunner",
        "--inputTopicName=inputTopicNameValue",
        "--Argument=Value",
        "--streaming=true"]
}
' http://<JobManager-hostname>:<port>/jars/MyApplication.jar/run