MacOS 安装flink中遇到的问题

系统MacOS Catalina

1.安装步骤

brew install apache-flink

2.默认安装位置

/usr/local/Cellar/apache-flink/1.10.0

和直接从官网下载的压缩包解压不一样,通过brew安装的flink,真正的安装位置不在bin,而在/usr/local/Cellar/apache-flink/1.10.0/libexec/下面。

进入这个目录

bin里面可以执行脚本,可以执行./start-cluster.sh (这里不能用sh执行,只能用.)。控制台会报

Starting cluster.
Starting standalonesession daemon on host C02C10YSLVL.
Starting taskexecutor daemon on host C02C10YSLVL.

查看jps也会有进程TaskManagerRunner,但是没有StandaloneSessionClusterEntrypoint进程,同时访问控制台http://localhost:8081失败。

查看/usr/local/Cellar/apache-flink/1.10.0/libexec/log下的日志,会发现每个日志都有个编号,flink在你每次启动都会创建新文件然后编号递增,本次启动就看编号最大的文件即可。观察taskexecutor日志,有如下报错:

2020-05-05 12:27:20,555 INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator         - Remoting shut down.
2020-05-05 12:27:20,556 INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator         - Remoting shut down.
2020-05-05 12:27:20,570 INFO  org.apache.flink.runtime.rpc.akka.AkkaRpcService              - Stopped Akka RPC service.
2020-05-05 12:27:20,571 INFO  org.apache.flink.runtime.rpc.akka.AkkaRpcService              - Stopped Akka RPC service.
2020-05-05 12:27:20,572 ERROR org.apache.flink.runtime.entrypoint.ClusterEntrypoint         - Could not start cluster entrypoint StandaloneSessionClusterEntrypoint.
org.apache.flink.runtime.entrypoint.ClusterEntrypointException: Failed to initialize the cluster entrypoint StandaloneSessionClusterEntrypoint.
	at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:187)
	at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runClusterEntrypoint(ClusterEntrypoint.java:518)
	at org.apache.flink.runtime.entrypoint.StandaloneSessionClusterEntrypoint.main(StandaloneSessionClusterEntrypoint.java:64)
Caused by: org.apache.flink.util.FlinkException: Could not create the DispatcherResourceManagerComponent.
	at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:261)
	at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:215)
	at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$0(ClusterEntrypoint.java:169)
	at org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
	at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:168)
	... 2 more
Caused by: java.net.BindException: Could not start rest endpoint on any port in port range 8081
	at org.apache.flink.runtime.rest.RestServerEndpoint.start(RestServerEndpoint.java:219)
	at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:165)

可以发现是端口绑定错误是8081端口被占用了,那么换一个端口即可。

vim /usr/local/Cellar/apache-flink/1.10.0/libexec/conf/flink-conf.yaml

搜索8081,换成没有被占用的端口即可,这里换成8085。保存后重新执行./start-cluster.sh

打开网址http://localhost:8085/

MacOS 安装flink中遇到的问题_第1张图片

 

你可能感兴趣的:(flink)