从 IDE 运行时的 Flink webui [英] Flink webui when running from IDE
问题描述
我正在尝试在网络用户界面中查看我的工作.
I am trying to see my job in the web ui.
我使用 createLocalEnvironmentWithWebUI,代码在 IDE 中运行良好,但无法在 http://localhost 中看到我的工作:8081/#/概览
I use createLocalEnvironmentWithWebUI, code is running well in IDE, but impossible to see my job in http://localhost:8081/#/overview
val conf: Configuration = new Configuration()
import org.apache.flink.configuration.ConfigConstants
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true)
val env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf)
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
val rides = env.addSource(
new TaxiRideSource("nycTaxiRides.gz", 1,100))//60, 600))
val filteredRides = rides
.filter(r => GeoUtils.isInNYC(r.startLon, r.startLat) && GeoUtils.isInNYC(r.endLon, r.endLat))
.map(r => (r.passengerCnt, 1))
.keyBy(_._1)
.window(TumblingTimeWindows.of(Time.seconds(5)))
.sum(1)
.map(r => (r._1.toString+"test", r._2))
filteredRides.print()
env.execute("Taxi Ride Cleansing")
我需要设置其他东西吗?
Did I need to setup something else?
推荐答案
通过将 flink-runtime-web 添加到我的项目的依赖项中,我能够从 IntelliJ 启动 Flink webui.我通过将它添加到我的 pom.xml 文件来做到这一点:
I was able to start the Flink webui from IntelliJ by adding flink-runtime-web to the dependencies for my project. I did this by adding this to my pom.xml file:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime-web_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
然后您还需要创建一个包含 WebUI 的本地执行环境:
You also then need to create a local execution environment that includes the WebUI:
Configuration conf = new Configuration();
env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);
这篇关于从 IDE 运行时的 Flink webui的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!