spark-shell 报 WARN ipc.Client: Failed to connect to server: xxx/xxx.xxx.xx.xx:8032: retries get failed due to exceeded maximum allowed retries number: 0 java.net.ConnectException: Connection refused
CAUSE:
In Yarn configs -> custom yarn-site.xml, you might have configuration for rm1 as resource-manager-A. This is the reason first attempt to connect was made to this server and then got connection refused. Then it goes to active resource manager which is resource-manager-B. This warning is not seen when resource-manager-A is active, because the property rm1 pointing to this server, first connect attempt is successful. First connection attempt is always made to the resource manager which is specified in rm1.
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
遇到这个警告信息,意味着Spark Shell尝试连接到YARN集群的ResourceManager时失败了。具体来说,它试图连接到配置中的一个ResourceManager(rm1,地址为xxx.xxx.xx.xx:8032),但是该连接被拒绝了,因为该ResourceManager可能不是当前活动的ResourceManager或者服务未启动。
要解决这个问题,你可以采取以下几个步骤:
确认ResourceManager状态:首先确保你尝试连接的ResourceManager是当前集群中活跃的ResourceManager。如果资源管理器有高可用(HA)配置,你需要指向当前激活的服务地址。
检查yarn-site.xml配置:打开你的YARN配置文件yarn-site.xml
,检查是否有硬编码指定了ResourceManager的地址。特别是注意yarn.resourcemanager.hostname
和任何自定义的 ResourceManager 配置(如你提到的rm1)。确保这些配置指向正确的、活动的ResourceManager地址。
更新ResourceManager地址:如果发现配置错误或ResourceManager地址已变更,需要更新yarn-site.xml
中的相关配置项,使其指向正确的ResourceManager地址。
重新分发配置:修改配置后,需要确保这些更改被应用到所有相关的YARN节点上,并且可能需要重启YARN服务以使更改生效。
使用YARN客户端工具验证:在进行Spark作业提交之前,可以先用YARN的客户端工具(如yarn rmadmin -getServiceState rm1
)来验证ResourceManager的状态,确保能够成功连接到正确的ResourceManager。
Spark Shell启动参数:如果你在启动Spark Shell时直接指定了YARN ResourceManager地址,确保使用的地址是正确的。例如,如果你通常通过--master yarn
启动,而YARN集群配置复杂,可能需要更具体的命令行参数,如--master yarn://active_rm_host:8032
。
通过上述步骤,你应该能解决连接问题并顺利运行Spark作业。如果问题依然存在,建议查看YARN的日志文件,进一步排查网络问题或ResourceManager的配置问题。