我如何知道 Apache Flink 在哪个端口上运行?

How can I tell which port Apache Flink runs on?

我安装了 apache flink,转到 flink-1.14.3 文件夹和 运行 .bin/start-cluster.sh

看来已经成功启动集群了,因为它输出了这个-

Starting cluster.
Starting standalonesession daemon on host MacBook.local.
Starting taskexecutor daemon on host MacBook.local.

如何判断 Flink 运行 在哪个端口?我在浏览器中访问了 http://localhost:8081/,但那里什么也没有。

根据 https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/try-flink/local_installation/ 你应该可以在 http://localhost:8081/

上访问它

WebUI 的端口在 conf/flink-conf.yaml 中用选项 rest.port 指定。正如 official documentation 所说,端口的默认值为 8081。如果该端口已被其他应用程序使用,您可以在 conf/flink-conf.yaml.

中指定另一个端口

如果你想知道哪个应用正在监听8081,你可以参考这些答案:

Who is listening on a given TCP port on Mac OS X? https://unix.stackexchange.com/questions/106561/finding-the-pid-of-the-process-using-a-specific-port

如果没有应用使用8081端口,无法通过localhost:8081访问WebUI,可能是Flink本身不正常运行。对于 Flink 的本地安装,您可以查看 log 文件夹中的日志文件,了解发生了什么。