[ https://issues.apache.org/jira/browse/AMBARI-22800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xianghao Lu updated AMBARI-22800: --------------------------------- Description: Ambari agent sometimes get a wrong FQDN by python function socket.getfqdn(), for example, host uses the /_etc_/_hosts_ file to resolve hostname to IP addresses, as a result, Ambari agent will register failed. My case is as follows: [root@test01 ~]$ hostname test01.example.com [root@test01 ~]$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain 10.208.47.45 a01 [root@test01 ~]$ python Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> print socket.getfqdn() test01 Agent error log: INFO 2018-01-17 15:52:29,774 hostname.py:67 - agent:hostname_script configuration not defined thus read hostname 'test01' using socket.getfqdn(). ERROR 2018-01-17 15:52:29,774 main.py:244 - Ambari agent machine hostname (test01) does not match expected ambari server hostname (test01.example.com). Aborting registration. Please check hostname, hostname -f and /etc/hosts file to confirm your hostname is setup correctly Related Links: There are other examples in the link for registeration failure because of wrong FQDN. [https://bugs.python.org/issue5004] was: Ambari agent sometimes get a wrong FQDN by python function socket.getfqdn(), for example, host uses the /_etc_/_hosts_ file to resolve hostname to IP addresses, as a result, Ambari agent will register failed. My case is as follows: [root@test ~]$ hostname test.example.com [root@test ~]$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain 10.208.47.45 a01 [root@test ~]$ python Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> print socket.getfqdn() a01 Agent error log: INFO 2018-01-17 15:52:29,774 hostname.py:67 - agent:hostname_script configuration not defined thus read hostname 'a01' using socket.getfqdn(). ERROR 2018-01-17 15:52:29,774 main.py:244 - Ambari agent machine hostname (a01) does not match expected ambari server hostname (test.example.com). Aborting registration. Please check hostname, hostname -f and /etc/hosts file to confirm your hostname is setup correctly Related Links: [https://bugs.python.org/issue5004] > Ambari agent get wrong FQDN by getfqdn() > ---------------------------------------- > > Key: AMBARI-22800 > URL: https://issues.apache.org/jira/browse/AMBARI-22800 > Project: Ambari > Issue Type: Bug > Components: ambari-agent > Affects Versions: trunk > Reporter: Xianghao Lu > Priority: Major > Attachments: AMBARI-22800.patch > > > Ambari agent sometimes get a wrong FQDN by python function socket.getfqdn(), > for example, host uses the /_etc_/_hosts_ file to resolve hostname to IP > addresses, as a result, Ambari agent will register failed. My case is as > follows: > [root@test01 ~]$ hostname > test01.example.com > [root@test01 ~]$ cat /etc/hosts > 127.0.0.1 localhost localhost.localdomain > 10.208.47.45 a01 > [root@test01 ~]$ python > Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import socket > >>> print socket.getfqdn() > test01 > > Agent error log: > INFO 2018-01-17 15:52:29,774 hostname.py:67 - agent:hostname_script > configuration not defined thus read hostname 'test01' using socket.getfqdn(). > ERROR 2018-01-17 15:52:29,774 main.py:244 - Ambari agent machine hostname > (test01) does not match expected ambari server hostname (test01.example.com). > Aborting registration. Please check hostname, hostname -f and /etc/hosts file > to confirm your hostname is setup correctly > > Related Links: > There are other examples in the link for registeration failure because of > wrong FQDN. > [https://bugs.python.org/issue5004] > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)