目的: 调试时,每次打开web-UI 都需要到日志中寻找端口, 此处希望指定确定的端口
添加依赖:
<flink.version>1.13.1</flink.version> <scala.binary.version>2.12</scala.binary.version>
<dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-runtime-web_${scala.binary.version}</artifactId> <version>${flink.version}</version> </dependency>
方式一:
// 启动一个webUI,指定本地WEB-UI端口号 Configuration configuration = new Configuration(); configuration.setInteger(RestOptions.PORT, 8081); StreamExecutionEnvironment evn = StreamExecutionEnvironment.getExecutionEnvironment(configuration);
方式二:
// 启动一个webUI,指定本地WEB-UI端口号 Configuration configuration = new Configuration(); configuration.setInteger(RestOptions.PORT, 8081); StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(configuration);
localhost:8082