Skip to content

Commit 95f6e00

Browse files
Zzzz-zmyZzm0809
andauthored
[Feature] Implementing Yarn mode cluster configuration supports configuring the rs protocol (#3442)
Signed-off-by: Zzm0809 <934230207@qq.com> Co-authored-by: Zzm0809 <Zzm0809@users.noreply.github.com>
1 parent 3695aaf commit 95f6e00

File tree

5 files changed

+44
-15
lines changed

5 files changed

+44
-15
lines changed

dinky-gateway/src/main/java/org/dinky/gateway/yarn/YarnApplicationGateway.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.dinky.gateway.result.GatewayResult;
2929
import org.dinky.gateway.result.YarnResult;
3030
import org.dinky.utils.LogUtil;
31+
import org.dinky.utils.URLUtils;
3132

3233
import org.apache.flink.client.deployment.ClusterSpecification;
3334
import org.apache.flink.client.deployment.application.ApplicationConfiguration;
@@ -42,6 +43,8 @@
4243
import java.util.Collections;
4344
import java.util.stream.Collectors;
4445

46+
import cn.hutool.core.util.URLUtil;
47+
4548
/**
4649
* YarnApplicationGateway
4750
*
@@ -54,14 +57,28 @@ public GatewayType getType() {
5457
return GatewayType.YARN_APPLICATION;
5558
}
5659

60+
/**
61+
* format url
62+
* <p>if url is rs protocol, convert to file path</p>
63+
* @param url url
64+
* @return formatted url
65+
*/
66+
private String formatUrl(String url) {
67+
if (URLUtil.url(url).getProtocol().equals("rs")) {
68+
return URLUtils.toFile(url).getAbsolutePath();
69+
} else {
70+
return url;
71+
}
72+
}
73+
5774
@Override
5875
public GatewayResult submitJar(FlinkUdfPathContextHolder udfPathContextHolder) {
5976
if (Asserts.isNull(yarnClient)) {
6077
init();
6178
}
6279

6380
AppConfig appConfig = config.getAppConfig();
64-
configuration.set(PipelineOptions.JARS, Collections.singletonList(appConfig.getUserJarPath()));
81+
configuration.set(PipelineOptions.JARS, Collections.singletonList(formatUrl(appConfig.getUserJarPath())));
6582
configuration.setString(
6683
"python.files",
6784
udfPathContextHolder.getPyUdfFile().stream().map(File::getName).collect(Collectors.joining(",")));

dinky-web/src/locales/en-US/pages.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,10 @@ export default {
785785
'rc.cc.sqlSubmitJarPath': 'Jar File Path',
786786
'rc.cc.sqlSubmitJarPathHelp':
787787
'Please enter the Jar file path! eg: hdfs:///dinky/dinky-app-1.16-with-dependencies.jar',
788+
'rc.cc.sqlSubmitJarPathHelpTips':
789+
'In Yarn mode, this parameter can be set to: hdfs:///dinky/dinky-app-1.17-with-dependencies.jar Alternatively, if rs:/dinky/inky app 1.17 with dependencies. jar is set to the rs:/ protocol, the jar package needs to be uploaded to Dinky`s resource center and the path filled in. In K8s mode, only the local://protocol is supported',
788790
'rc.cc.start': 'Start Session Cluster',
789-
'rc.cc.submitSqlConfig': 'Submit FlinkSQL Config items (required in Application mode)',
791+
'rc.cc.submitSqlConfig': 'Submit FlinkSQL Config items',
790792
'rc.cc.tmHeap': 'TaskManager Heap Memory',
791793
'rc.cc.tmHeapHelp':
792794
'Please enter the TaskManager heap memory size! This parameter configuration item is',

dinky-web/src/locales/zh-CN/pages.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,10 @@ export default {
752752
'rc.cc.sqlSubmitJarPath': 'Jar 文件路径',
753753
'rc.cc.sqlSubmitJarPathHelp':
754754
'请输入 Jar 文件路径! eg: hdfs:///dinky/dinky-app-1.16-with-dependencies.jar',
755+
'rc.cc.sqlSubmitJarPathHelpTips':
756+
'Yarn 模式下此参数可以设置为: hdfs:///dinky/dinky-app-1.17-with-dependencies.jar 或者 rs:/dinky/dinky-app-1.17-with-dependencies.jar 如果设置为 rs:/ 协议,则需要将该jar包上传到 Dinky 的资源中心中,然后填写该路径。K8s 模式下仅支持 local:// 协议',
755757
'rc.cc.start': '启动 Session 集群',
756-
'rc.cc.submitSqlConfig': '提交 FlinkSQL 配置项 (Application 模式必填)',
758+
'rc.cc.submitSqlConfig': '提交 FlinkSQL 配置项',
757759
'rc.cc.tmHeap': 'TaskManager 堆内存',
758760
'rc.cc.tmHeapHelp': '请输入 TaskManager 堆内存大小! 此参数配置项为',
759761
'rc.cc.tmMem': 'TaskManager 内存',

dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/ApplicationConfig/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ const ApplicationConfig = () => {
2828
<ProFormGroup labelLayout={'inline'}>
2929
<ProFormText
3030
width={'xl'}
31+
rules={[
32+
{
33+
required: true,
34+
message: l('rc.cc.sqlSubmitJarPathHelp')
35+
}
36+
]}
3137
name={['config', 'appConfig', 'userJarPath']}
3238
placeholder={l('rc.cc.sqlSubmitJarPathHelp')}
3339
label={l('rc.cc.sqlSubmitJarPath')}
34-
tooltip={l('rc.cc.sqlSubmitJarPathHelp')}
40+
tooltip={l('rc.cc.sqlSubmitJarPathHelpTips')}
3541
/>
3642
</ProFormGroup>
3743
</>

docs/docs/user_guide/register_center/cluster_manage.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ title: 集群
3131
3. 自动注册的集群无需关心注册过多的情况, 系统会定时清理过期的 自动注册的 Flink 实例,手动注册的无影响
3232
4. 手动注册的集群需要手动管理 Flink 实例, 如需删除 Flink 实例,请鼠标悬浮某一 Flink 实例,点击删除按钮即可删除 Flink 实例
3333
5. 提供手动进行心跳检测
34-
6. 所有Flink 实例删除前会进行引用检测,如果有引用,则无法删除(此为避免实际运行中的任务关联到该Flink 实例,从而导致一系列问题)
35-
7. 手动注册的集群可以直接删除(前提是未被使用),如果自动注册的集群如果状态为`健康`需要先停止 Flink 实例,然后再删除 Flink 实例.
34+
6. 所有Flink 实例删除前会进行引用检测,如果有引用,则无法删除(此为避免实际运行中的任务关联到该Flink
35+
实例,从而导致一系列问题)
36+
7. 手动注册的集群可以直接删除(前提是未被使用),如果自动注册的集群如果状态为`健康`需要先停止 Flink 实例,然后再删除 Flink
37+
实例.
3638

3739
如需查看 自动注册 和 手动注册 下的 Flink 实例,请点击切换按钮进行查看
3840
:::
@@ -47,13 +49,13 @@ title: 集群
4749

4850
### 参数解读
4951

50-
| 参数 | 说明 | 是否必填 | 默认值 | 示例值 |
51-
|-----------------|------------------------------------------------------------------------------------|:----:|:-----:|:-------------:|
52-
| 集群名称 | 集群名称, 用于区分不同集群 ||| flink-session |
53-
| 集群别名 | 集群别名, 用于区分不同集群, 如不填默认同集群名称 || 同集群名称 | flink-session |
54-
| 集群类型 | 集群类型, 目前支持 Local, Standalone, Yarn Session, Kubernetes Session ||| Standalone |
52+
| 参数 | 说明 | 是否必填 | 默认值 | 示例值 |
53+
|------------------|----------------------------------------------------------------------------------|:----:|:-----:|:-------------:|
54+
| 集群名称 | 集群名称, 用于区分不同集群 ||| flink-session |
55+
| 集群别名 | 集群别名, 用于区分不同集群, 如不填默认同集群名称 || 同集群名称 | flink-session |
56+
| 集群类型 | 集群类型, 目前支持 Local, Standalone, Yarn Session, Kubernetes Session ||| Standalone |
5557
| JobManager 高可用地址 | 添加 Flink 集群的 JobManager 的 RestApi 地址。当 HA 模式时,地址间用英文逗号分隔,例如:192.168.123.101:8081 |||
56-
| 备注 | 备注, 用于备注集群信息 ||| flink-session |
58+
| 备注 | 备注, 用于备注集群信息 ||| flink-session |
5759

5860
## 集群配置
5961

@@ -91,9 +93,9 @@ title: 集群
9193

9294
- 提交 FlinkSQL 配置项 (Application 模式必填)-公共配置
9395

94-
| 参数 | 说明 | 是否必填 | 默认值 | 示例值 |
95-
|----------|----------------------------------------------------------------------------------------------------------|:----:|:---:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
96-
| Jar 文件路径 | 指定 Jar 文件路径,如果该集群配置用于提交 Application 模式任务时 则必填<br/>需要包含以下文件:dinky-app-{version}-jar-with-dependencies.jar | || hdfs:///dinky/dinky-app-1.16-1.0.0-SNAPSHOT-jar-with-dependencies.jar <br/>请注意: 如果使用 Kubernetes 模式,路径需要指定为: local:///dinky/dinky-app-1.16-1.0.0-SNAPSHOT-jar-with-dependencies.jar |
96+
| 参数 | 说明 | 是否必填 | 默认值 | 示例值 |
97+
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----:|:---:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
98+
| Jar 文件路径 | 指定 Jar 文件路径,如果该集群配置用于提交 Application 模式任务时 则必填<br/>需要包含以下文件:dinky-app-{version}-jar-with-dependencies.jar<br/>Yarn 模式下此参数可以设置为: hdfs:///dinky/dinky-app-1.17-with-dependencies.jar 或者 rs:/dinky/dinky-app-1.17-with-dependencies.jar <br/>如果设置为 rs:/ 协议,则需要将该jar包上传到 Dinky 的资源中心中,然后填写该路径。<br/>K8s 模式下仅支持 local:// 协议 | || hdfs:///dinky/dinky-app-1.16-1.0.0-SNAPSHOT-jar-with-dependencies.jar <br/>请注意: 如果使用 Kubernetes 模式,路径需要指定为: local:///dinky/dinky-app-1.16-1.0.0-SNAPSHOT-jar-with-dependencies.jar |
9799

98100
- Flink 预设配置(高优先级)-公共配置
99101

0 commit comments

Comments
 (0)