Ambari 启动时提示:socket.gaierror: [Errno -2] Name or service not known

错误信息如下:

un 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: File "/usr/lib/ambari-agent/lib/ambari_agent/Facter.py", line 81, in getIpAddress
Jun 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: return socket.gethostbyname(self.getFqdn().lower())
Jun 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: socket.gaierror: [Errno -2] Name or service not known
Jun 22 22:04:49 hadoop1.lts.local systemd[1]: ambari-agent.service: control process exited, code=exited status=255
Jun 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: ====================
Jun 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: Agent out at: /var/log/ambari-agent/ambari-agent.out
Jun 22 22:04:49 hadoop1.lts.local ambari-agent[26996]: Agent log at: /var/log/ambari-agent/ambari-agent.log
Jun 22 22:04:49 hadoop1.lts.local systemd[1]: Failed to start LSB: ambari-agent daemon.
Jun 22 22:04:49 hadoop1.lts.local systemd[1]: Unit ambari-agent.service entered failed state.
Jun 22 22:04:49 hadoop1.lts.local systemd[1]: ambari-agent.service failed.

这个问题其时是域名无法解析造成的, 当ping hadoop1.lts.local 就会提示Name or service not known, 而我在 /etc/hosts 明明是配置了如下解析的,为什么解析不了呢,

192.168.19.10 hadoop1.lts.local dosercn60001 h1
192.168.19.11 hadoop2.lts.local dosercn60002 h2
192.168.19.12 hadoop3.lts.local dosercn60003 h3
192.168.19.13 hadoop4.lts.local dosercn60004 h4
192.168.19.14 hadoop5.lts.local dosercn60005 h5
192.168.19.15 hadoop6.lts.local dosercn60006 h6
192.168.19.16 hadoop7.lts.local dosercn60007 h7

原来是因为我服务器原来安装的是CDH, 在删除CDH过程中误删除了 这个文件导致: /etc/nsswitch.conf

解决方法是: 从一台有改文件的机器拷一份过来放到/etc 下面就正常了, 这个文件只要os版本一样都是一样的.

Be the first to comment

Leave a Reply

Your email address will not be published.


*