How can I start the Flink job manager web interface when running Flink from an IDE

☆樱花仙子☆ 提交于 2019-11-27 16:17:43

问题


I would like to access the Flink Web interface when starting it locally from the IDE.

I need this because I'd like to access the counters (accumulators) of Flink.


回答1:


In order to start the web interface when starting Flink locally, we have to enable the web interface in the FlinkMiniCluster. The FlinkMiniCluster is the class managing the startup of all Flink services locally.

Include the dependency:

<dependency>
  <groupId>org.apache.flink</groupId>
  <artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
  <version>${flink.version}</version>
</dependency>

The following snippet will enable the web interface for a StreamExecutionEnvironment:

// set up the execution environment
Configuration conf = new Configuration();
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
final StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment(8, conf);

You can also use RestOptions to configure the server:

conf.setInteger(RestOptions.PORT, 8082);



回答2:


In addition to the code in the above answer, the following dependency is also required in the pom file.

    <dependency>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
        <version>${flink.version}</version>
    </dependency>


来源:https://stackoverflow.com/questions/35138538/how-can-i-start-the-flink-job-manager-web-interface-when-running-flink-from-an-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!