Apache flink 当通过客户端提交程序或在测试环境上下文中运行时,不能使用RemoteEnvironment
我试图以Kafka作为输入和输出来执行ApacheBeam字数计数。但是在将jar提交到flink集群时,出现了这个错误-Apache flink 当通过客户端提交程序或在测试环境上下文中运行时,不能使用RemoteEnvironment,apache-flink,apache-beam,flink-streaming,apache-beam-io,apache-beam-kafkaio,Apache Flink,Apache Beam,Flink Streaming,Apache Beam Io,Apache Beam Kafkaio,我试图以Kafka作为输入和输出来执行ApacheBeam字数计数。但是在将jar提交到flink集群时,出现了这个错误- The RemoteEnvironment cannot be used when submitting a program through a client, or running in a TestEnvironment context. org.apache.flink.streaming.api.environment.RemoteStreamEnviron
The RemoteEnvironment cannot be used when submitting a program through a client, or running in a TestEnvironment context.
org.apache.flink.streaming.api.environment.RemoteStreamEnvironment.<init>(RemoteStreamEnvironment.java:174)
org.apache.flink.streaming.api.environment.RemoteStreamEnvironment.<init>(RemoteStreamEnvironment.java:142)
org.apache.beam.runners.flink.FlinkExecutionEnvironments$BeamFlinkRemoteStreamEnvironment.<init>(FlinkExecutionEnvironments.java:331)
org.apache.beam.runners.flink.FlinkExecutionEnvironments.createStreamExecutionEnvironment(FlinkExecutionEnvironments.java:180)
org.apache.beam.runners.flink.FlinkExecutionEnvironments.createStreamExecutionEnvironment(FlinkExecutionEnvironments.java:141)
org.apache.beam.runners.flink.FlinkPipelineExecutionEnvironment.translate(FlinkPipelineExecutionEnvironment.java:98)
org.apache.beam.runners.flink.FlinkRunner.run(FlinkRunner.java:110)
org.apache.beam.sdk.Pipeline.run(Pipeline.java:315)
org.apache.beam.sdk.Pipeline.run(Pipeline.java:301)
org.apache.beam.examples.WordCount.runWordCount(WordCount.java:295)
org.apache.beam.examples.WordCount.main(WordCount.java:406)
我猜您使用的是StreamExecutionEnvironment.createRemoteEnvironment,这就是您不能使用“flink run”提交jar的方式,您必须将其作为常规java jar(java-jar…)运行 如果要在集群中提交,应使用StreamExecutionEnvironment.getExecutionEnvironment,它将返回已提交集群的executionEnvironment
./flink run -m localhost:8081 --class org.apache.beam.examples.WordCount /users/word-count-beam/target/word-count-beam-bundled-0.1.jar --runner=FlinkRunner --flinkMaster=localhost --parallelism=2 --checkpointingInterval=10000 --checkpointTimeoutMillis=5000 --minPauseBetweenCheckpoints=500