最近flink是不是有啥问题 简单的select 查询都报错 ?部署上线可以执行 点击调试就不行报错。high-availability: org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory 是不是这个参数有问题?INTERNAL: Occur FlinkServerException or FlinkSQLException during submitting preview: org.apache.flink.table.api.TableException: Failed to execute sql
at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeQueryOperation(TableEnvironmentImpl.java:1045)
at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:1507)
at org.apache.flink.table.sqlserver.execution.OperationExecutorImpl.executeOperation(OperationExecutorImpl.java:552)
at org.apache.flink.table.sqlserver.preview.SelectPreviewJob.doSubmitJob(SelectPreviewJob.java:65)
at org.apache.flink.table.sqlserver.preview.AbstractPreviewJob.submitJob(AbstractPreviewJob.java:40)
at org.apache.flink.table.sqlserver.execution.OperationExecutorImpl.runPreview(OperationExecutorImpl.java:728)
at org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.lambda$runPreview$16(DelegateOperationExecutor.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
at org.apache.flink.table.sqlserver.context.SqlServerSecurityContext.runSecured(SqlServerSecurityContext.java:72)
at org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.wrapClassLoader(DelegateOperationExecutor.java:311)
at org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.lambda$wrapExecutor$35(DelegateOperationExecutor.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1147)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
at java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Couldn't retrieve standalone cluster
at org.apache.flink.client.deployment.StandaloneClusterDescriptor.lambda$retrieve$0(StandaloneClusterDescriptor.java:53)
at org.apache.flink.client.deployment.executors.AbstractSessionClusterExecutor.execute(AbstractSessionClusterExecutor.java:84)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:2239)
at org.apache.flink.table.planner.delegation.DefaultExecutor.executeAsync(DefaultExecutor.java:110)
at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeQueryOperation(TableEnvironmentImpl.java:1026)
... 16 more
Caused by: org.apache.flink.util.FlinkException: Could not create the client ha services from the instantiated HighAvailabilityServicesFactory org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory.
at org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils.createCustomClientHAServices(HighAvailabilityServicesUtils.java:331)
at org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils.createCustomClientHAServices(HighAvailabilityServicesUtils.java:318)
at org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils.createClientHAService(HighAvailabilityServicesUtils.java:171)
at org.apache.flink.runtime.highavailability.DefaultClientHighAvailabilityServicesFactory.create(DefaultClientHighAvailabilityServicesFactory.java:35)
at org.apache.flink.client.program.rest.RestClusterClient.(RestClusterClient.java:237)
at org.apache.flink.client.program.rest.RestClusterClient.(RestClusterClient.java:197)
at org.apache.flink.client.program.rest.RestClusterClient.(RestClusterClient.java:191)
at org.apache.flink.client.deployment.StandaloneClusterDescriptor.lambda$retrieve$0(StandaloneClusterDescriptor.java:51)
... 20 more
Caused by: java.lang.IllegalArgumentException: Configuration option 'kubernetes.cluster-id' is not set.
at org.apache.flink.kubernetes.kubeclient.Fabric8FlinkKubeClient.lambda$new$0(Fabric8FlinkKubeClient.java:100)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.apache.flink.kubernetes.kubeclient.Fabric8FlinkKubeClient.(Fabric8FlinkKubeClient.java:97)
at org.apache.flink.kubernetes.kubeclient.FlinkKubeClientFactory.fromConfiguration(FlinkKubeClientFactory.java:105)
at org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory.createHAServices(KubernetesHaServicesFactory.java:38)
at org.apache.flink.runtime.highavailability.HighAvailabilityServicesFactory.createClientHAServices(HighAvailabilityServicesFactory.java:49)
at org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils.createCustomClientHAServices(HighAvailabilityServicesUtils.java:328)
... 27 more
这个报错信息显示是由于在使用 Flink 的时候,KubernetesHaServicesFactory 这个参数没有正确配置导致的。具体来说,是因为 kubernetes.cluster-id 这个配置项没有设置。
在 Flink 中,KubernetesHaServicesFactory 是用于提供高可用性服务的工厂类。在 Flink 中,高可用性服务主要包括 JobManager HA、LeaderElectionService 等。如果你想在 Kubernetes 上运行 Flink,那么就需要使用 KubernetesHaServicesFactory 来提供这些高可用性服务。
解决这个问题需要检查以下几个方面:
检查 Flink 配置文件中是否正确设置了 kubernetes.cluster-id 配置项。这个配置项用于指定 Kubernetes 集群的 ID。
检查 Kubernetes 集群是否正常运行,并且 Flink 是否有权限访问该集群。
检查 Flink 应用程序的代码,看看是否正确地使用了 KubernetesHaServicesFactory。
这个错误信息显示Flink在尝试创建一个Flink集群时遇到了问题。具体来说,它似乎无法创建一个HA(高可用性)服务,这是Flink的一个重要功能,用于确保在Flink集群发生故障时能够恢复数据和应用程序的状态。
从错误信息中,我们可以看到这个错误是由一个名为KubernetesHaServicesFactory
的类引起的。这个类是一个用于创建Flink在Kubernetes集群中的HA服务的工厂。但是,错误信息指出,这个工厂在尝试创建一个HA服务时遇到了问题,因为配置选项kubernetes.cluster-id
没有被设置。kubernetes.cluster-id
是一个用于标识Kubernetes集群的配置选项。在使用Flink在Kubernetes集群中运行时,这个选项是必需的,因为Flink需要知道它正在运行在哪个集群中。因此,如果这个选项没有被设置,Flink将无法创建一个HA服务。
为了解决这个问题,你需要确保你的Flink配置文件中包含了正确的kubernetes.cluster-id
配置选项,并且它的值与你的Kubernetes集群的名称相匹配。如果你不确定如何设置这个选项,你可以查阅Flink的官方文档或寻求其他Flink用户的支持。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
实时计算Flink版是阿里云提供的全托管Serverless Flink云服务,基于 Apache Flink 构建的企业级、高性能实时大数据处理系统。提供全托管版 Flink 集群和引擎,提高作业开发运维效率。