从IDE运行时Flink WebUI [英] Flink webui when running from IDE

查看:277
本文介绍了从IDE运行时Flink WebUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在网络用户界面中查看我的工作.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆