从 IDE 运行 Flink 时如何启动 Flink 作业管理器 Web 界面 [英] How can I start the Flink job manager web interface when running Flink from an IDE
问题描述
我想从 IDE 本地启动时访问 Flink Web 界面.
I would like to access the Flink Web interface when starting it locally from the IDE.
我需要这个,因为我想访问 Flink 的计数器(累加器).
I need this because I'd like to access the counters (accumulators) of Flink.
推荐答案
为了在本地启动 Flink 时启动 Web 界面,我们必须在 FlinkMiniCluster
中启用 Web 界面.FlinkMiniCluster
是管理本地所有 Flink 服务启动的类.
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.
包含依赖:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
以下代码段将为 StreamExecutionEnvironment
启用 Web 界面:
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);
您也可以使用 RestOptions 配置服务器:
You can also use RestOptions to configure the server:
conf.setInteger(RestOptions.PORT, 8082);
这篇关于从 IDE 运行 Flink 时如何启动 Flink 作业管理器 Web 界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!