flink-sql-gateway相关问题

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

flink-sql-gateway相关问题

zilong xiao
请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

SebastianLiu
sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config 配置,
对per job模式on yarn, 对应的配置是“yarn-per-job”,
这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
client
提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
org.apache.flink.yarn.configuration.YarnConfigOptions

zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:

> 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
>


--

*With kind regards
------------------------------------------------------------
Sebastian Liu 刘洋
Institute of Computing Technology, Chinese Academy of Science
Mobile\WeChat: +86—15201613655
E-mail: [hidden email] <[hidden email]>
QQ: 3239559*
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

zilong xiao
感谢您的回答,我在flink-conf.yaml里指定"execution.target: yarn-pre-job"后,尝试用rest
api生成session id时会遇到异常,不清楚是为何,可否帮忙看下

flink version: 1.11.3
execution.target: yarn-pre-job
rest api请求路径和参数:
http://localhost:8083/v1/sessions
    {
        "planner": "blink",
        "execution_type": "streaming"
   }

异常信息:Caused by: java.lang.IllegalStateException: No ClusterClientFactory
found. If you were targeting a Yarn cluster, please make sure to export the
HADOOP_CLASSPATH environment variable or have hadoop in your classpath. For
more information refer to the "Deployment & Operations" section of the
official Apache Flink documentation.

Sebastian Liu <[hidden email]> 于2021年1月27日周三 上午1:01写道:

> sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config 配置,
> 对per job模式on yarn, 对应的配置是“yarn-per-job”,
>
> 这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
> client
> 提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
> org.apache.flink.yarn.configuration.YarnConfigOptions
>
> zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:
>
> > 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
> >
>
>
> --
>
> *With kind regards
> ------------------------------------------------------------
> Sebastian Liu 刘洋
> Institute of Computing Technology, Chinese Academy of Science
> Mobile\WeChat: +86—15201613655
> E-mail: [hidden email] <[hidden email]>
> QQ: 3239559*
>
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

SebastianLiu
看报错提示,应该是没有指定正确HADOOP_HOME env? 如果用flink client提交,也是需要这个env的

zilong xiao <[hidden email]> 于2021年1月27日周三 上午10:17写道:

> 感谢您的回答,我在flink-conf.yaml里指定"execution.target: yarn-pre-job"后,尝试用rest
> api生成session id时会遇到异常,不清楚是为何,可否帮忙看下
>
> flink version: 1.11.3
> execution.target: yarn-pre-job
> rest api请求路径和参数:
> http://localhost:8083/v1/sessions
>     {
>         "planner": "blink",
>         "execution_type": "streaming"
>    }
>
> 异常信息:Caused by: java.lang.IllegalStateException: No ClusterClientFactory
> found. If you were targeting a Yarn cluster, please make sure to export the
> HADOOP_CLASSPATH environment variable or have hadoop in your classpath. For
> more information refer to the "Deployment & Operations" section of the
> official Apache Flink documentation.
>
> Sebastian Liu <[hidden email]> 于2021年1月27日周三 上午1:01写道:
>
> > sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config 配置,
> > 对per job模式on yarn, 对应的配置是“yarn-per-job”,
> >
> >
> 这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
> > client
> > 提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
> > org.apache.flink.yarn.configuration.YarnConfigOptions
> >
> > zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:
> >
> > > 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
> > >
> >
> >
> > --
> >
> > *With kind regards
> > ------------------------------------------------------------
> > Sebastian Liu 刘洋
> > Institute of Computing Technology, Chinese Academy of Science
> > Mobile\WeChat: +86—15201613655
> > E-mail: [hidden email] <[hidden email]>
> > QQ: 3239559*
> >
>


--

*With kind regards
------------------------------------------------------------
Sebastian Liu 刘洋
Institute of Computing Technology, Chinese Academy of Science
Mobile\WeChat: +86—15201613655
E-mail: [hidden email] <[hidden email]>
QQ: 3239559*
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

Lin Li
In reply to this post by zilong xiao
try:  "execution.target: yarn-pre-job"  ->  "execution.target: yarn-per-job"

zilong xiao <[hidden email]> 于2021年1月27日周三 上午10:17写道:

> 感谢您的回答,我在flink-conf.yaml里指定"execution.target: yarn-pre-job"后,尝试用rest
> api生成session id时会遇到异常,不清楚是为何,可否帮忙看下
>
> flink version: 1.11.3
> execution.target: yarn-pre-job
> rest api请求路径和参数:
> http://localhost:8083/v1/sessions
>     {
>         "planner": "blink",
>         "execution_type": "streaming"
>    }
>
> 异常信息:Caused by: java.lang.IllegalStateException: No ClusterClientFactory
> found. If you were targeting a Yarn cluster, please make sure to export the
> HADOOP_CLASSPATH environment variable or have hadoop in your classpath. For
> more information refer to the "Deployment & Operations" section of the
> official Apache Flink documentation.
>
> Sebastian Liu <[hidden email]> 于2021年1月27日周三 上午1:01写道:
>
> > sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config 配置,
> > 对per job模式on yarn, 对应的配置是“yarn-per-job”,
> >
> >
> 这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
> > client
> > 提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
> > org.apache.flink.yarn.configuration.YarnConfigOptions
> >
> > zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:
> >
> > > 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
> > >
> >
> >
> > --
> >
> > *With kind regards
> > ------------------------------------------------------------
> > Sebastian Liu 刘洋
> > Institute of Computing Technology, Chinese Academy of Science
> > Mobile\WeChat: +86—15201613655
> > E-mail: [hidden email] <[hidden email]>
> > QQ: 3239559*
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

zilong xiao
好的😓

Lin Li <[hidden email]> 于2021年1月27日周三 下午5:20写道:

> try:  "execution.target: yarn-pre-job"  ->  "execution.target:
> yarn-per-job"
>
> zilong xiao <[hidden email]> 于2021年1月27日周三 上午10:17写道:
>
> > 感谢您的回答,我在flink-conf.yaml里指定"execution.target: yarn-pre-job"后,尝试用rest
> > api生成session id时会遇到异常,不清楚是为何,可否帮忙看下
> >
> > flink version: 1.11.3
> > execution.target: yarn-pre-job
> > rest api请求路径和参数:
> > http://localhost:8083/v1/sessions
> >     {
> >         "planner": "blink",
> >         "execution_type": "streaming"
> >    }
> >
> > 异常信息:Caused by: java.lang.IllegalStateException: No ClusterClientFactory
> > found. If you were targeting a Yarn cluster, please make sure to export
> the
> > HADOOP_CLASSPATH environment variable or have hadoop in your classpath.
> For
> > more information refer to the "Deployment & Operations" section of the
> > official Apache Flink documentation.
> >
> > Sebastian Liu <[hidden email]> 于2021年1月27日周三 上午1:01写道:
> >
> > > sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config 配置,
> > > 对per job模式on yarn, 对应的配置是“yarn-per-job”,
> > >
> > >
> >
> 这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
> > > client
> > > 提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
> > > org.apache.flink.yarn.configuration.YarnConfigOptions
> > >
> > > zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:
> > >
> > > > 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
> > > >
> > >
> > >
> > > --
> > >
> > > *With kind regards
> > > ------------------------------------------------------------
> > > Sebastian Liu 刘洋
> > > Institute of Computing Technology, Chinese Academy of Science
> > > Mobile\WeChat: +86—15201613655
> > > E-mail: [hidden email] <[hidden email]>
> > > QQ: 3239559*
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: flink-sql-gateway相关问题

zilong xiao
关于flink sql gateway的使用方式,做了一个小总结,大概的使用步骤如下:

以yarn session cluster模式举例

4.1 启动一个yarn session cluster,注意SQL Gateway目前仅支持Flink 1.10 & 1.11.1+版本

#!/bin/bash
export HADOOP_CONF_DIR=/data/bigoflow/conf/testcluster
export HADOOP_HOME=/usr/hdp/3.1.0.0-78/hadoop
export PATH=$HADOOP_HOME/bin:$PATH
export HADOOP_CLASSPATH=`hadoop classpath`


export FLINK_HOME=/data/opt/flink-1.11.1
export FLINK_LOG_DIR=$CURRENT_PATH/log
export FLINK_CONF_DIR=/data/opt/flink-1.11.1/conf
export PATH=$FLINK_HOME/bin:$PATH

yarn-session.sh -d -jm 51200


4.2 修改$FLINK_HOME/conf/flink-conf.yaml中"jobmanager.rpc.address",
"jobmanager.rpc.port", "rest.port"配置,与步骤4.1中启动的jobmanager实际配置(可以在flink
dashboard上找到)一一对应即可

4.3 修改$FLINK_HOME/conf/flink-conf.yaml,新增如下配置

   -

   execution.target: yarn-session
   - yarn.application.id: application_xxx   --实际的application id

4.4 下载SQL Gateway <https://github.com/ververica/flink-sql-gateway/releases>,
进入到工作目录,修改./conf/sql-gateway-defaults.yaml,即启动时的默认配置,可选的配置可参考:
https://github.com/ververica/flink-sql-gateway#configuration

4.5 执行./bin/sql-gateway.sh启动SQL Gateway服务,至此,gateway服务已启动,可以使用REST
API访问gateway并提交作业,所需要的API如下

   - 创建session(POST):http://127.0.0.1:8083/v1/sessions
   <http://testcluster-dn4.jja.bigo-out:8083/v1/sessions>
   - 执行statement(POST):
   http://127.0.0.1:8083/v1/sessions/872b23766ed0d92ab005be09519d4178/statements
   <http://testcluster-dn4.jja.bigo-out:8083/v1/sessions/872b23766ed0d92ab005be09519d4178/statements>
   - 获取返回结果(GET):
   http://127.0.0.1:8083/v1/sessions/a81b0039baac263f2099d7947f728bf3/jobs/e4b0891df744877abea58d89412c1812/result/0
   <http://testcluster-dn4.jja.bigo-out:8083/v1/sessions/a81b0039baac263f2099d7947f728bf3/jobs/e4b0891df744877abea58d89412c1812/result/0>


zilong xiao <[hidden email]> 于2021年1月27日周三 下午5:39写道:

> 好的😓
>
> Lin Li <[hidden email]> 于2021年1月27日周三 下午5:20写道:
>
>> try:  "execution.target: yarn-pre-job"  ->  "execution.target:
>> yarn-per-job"
>>
>> zilong xiao <[hidden email]> 于2021年1月27日周三 上午10:17写道:
>>
>> > 感谢您的回答,我在flink-conf.yaml里指定"execution.target: yarn-pre-job"后,尝试用rest
>> > api生成session id时会遇到异常,不清楚是为何,可否帮忙看下
>> >
>> > flink version: 1.11.3
>> > execution.target: yarn-pre-job
>> > rest api请求路径和参数:
>> > http://localhost:8083/v1/sessions
>> >     {
>> >         "planner": "blink",
>> >         "execution_type": "streaming"
>> >    }
>> >
>> > 异常信息:Caused by: java.lang.IllegalStateException: No ClusterClientFactory
>> > found. If you were targeting a Yarn cluster, please make sure to export
>> the
>> > HADOOP_CLASSPATH environment variable or have hadoop in your classpath.
>> For
>> > more information refer to the "Deployment & Operations" section of the
>> > official Apache Flink documentation.
>> >
>> > Sebastian Liu <[hidden email]> 于2021年1月27日周三 上午1:01写道:
>> >
>> > > sql gateway 提交job方式和flink client类似主要取决于flink-conf中的execution.config
>> 配置,
>> > > 对per job模式on yarn, 对应的配置是“yarn-per-job”,
>> > >
>> > >
>> >
>> 这样加载的PipelineExecutor会控制为:YarnJobClusterExecutorFactory,具备向Yarn提交job的能力,这和使用flink
>> > > client
>> > > 提交job最终是一个调用路径,余下在flink-conf中添加上yarn相关配置我理解就可以了。
>> > > org.apache.flink.yarn.configuration.YarnConfigOptions
>> > >
>> > > zilong xiao <[hidden email]> 于2021年1月26日周二 下午4:00写道:
>> > >
>> > > > 请问有关于flink-sql-gateway rest api以pre job模式提交作业到yarn集群的文档吗?
>> > > >
>> > >
>> > >
>> > > --
>> > >
>> > > *With kind regards
>> > > ------------------------------------------------------------
>> > > Sebastian Liu 刘洋
>> > > Institute of Computing Technology, Chinese Academy of Science
>> > > Mobile\WeChat: +86—15201613655
>> > > E-mail: [hidden email] <[hidden email]>
>> > > QQ: 3239559*
>> > >
>> >
>>
>