为了方便flink本地开发配置了 webui
flink本地运行,访问webui方法:
添加依赖:flink-runtime-web
一定要添加这个依赖,否则访问页面是会报{“errors”:[“Not found.”]}
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime-web_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
- 1
- 2
- 3
- 4
- 5
代码:
val conf: Configuration = new Configuration()
import org.apache.flink.configuration.ConfigConstants
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true)
//自定义端口
conf.setInteger(RestOptions.PORT, 8050)
//本地env
val env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf)
//生产env
//val env = StreamExecutionEnvironment.getExecutionEnvironment
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
启动flink任务,浏览器输入http://localhost:8050