问题
I'm trying to debug my flink from intellij using the flink UI. the problem it somethims doesn't launched throwing java.net.BindException: Could not start rest endpoint on any port in port range 8081
my piece of code that should let the flink ui run (from windows) is:
String osName = System.getProperty("os.name");
if (osName.toLowerCase().contains("win")) {
Configuration conf = new Configuration();
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);
} else {
env = StreamExecutionEnvironment.getExecutionEnvironment();
}
can you assist please?
回答1:
If you cannot bind to a given network port that usually means it has been already taken. So check if there is any process running on that port (old job manager?) and kill it.
Alternatively, you can change the port with
conf.setInteger(RestOptions.PORT, 8082);
or if want to be on the save side specify a range
conf.setString(RestOptions.BIND_PORT, "8081-8099");
来源:https://stackoverflow.com/questions/58898543/cannot-launch-flink-from-local-host-when-trying-to-run-it-with-webui