ApacheFlink—当通过客户端提交程序或在TestenEnvironment上下文中运行时,不能使用remoteenvironment

gpfsuwkq  于 2021-06-21  发布在  Flink
关注(0)|答案(1)|浏览(409)

我试着用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.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)

我用来提交jar的命令-

./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
uemypmqf

uemypmqf1#

我想您应该使用streamexecutionenvironment.createremoteenvironment,这样您就不能用'flink run'提交jar,您必须像普通的javajar(java-jar…)一样运行它。
如果您想在集群中提交它,您应该使用streamexecutionenvironment.getexecutionenvironment,它将返回已提交集群的executionenvironment。

相关问题