[ 
https://issues.apache.org/jira/browse/AMBARI-19646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

kevin.chen reassigned AMBARI-19646:
-----------------------------------

    Assignee: kevin.chen

> AMBARI Java services do not resolve localhost FQDN properly in some cases
> -------------------------------------------------------------------------
>
>                 Key: AMBARI-19646
>                 URL: https://issues.apache.org/jira/browse/AMBARI-19646
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.4.2
>         Environment: Ubuntu 14 LTS
> HDP 2.5.3.0-37
>            Reporter: Piotr Tylenda
>            Assignee: kevin.chen
>            Priority: Minor
>
> When installing hive client I have noticed the following problem in the logs:
> {code}
> Traceback (most recent call last):
>   File 
> "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py",
>  line 68, in <module>
>     HiveClient().execute()
>   File 
> "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py",
>  line 280, in execute
>     method(env)
>   File 
> "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py",
>  line 35, in install
>     self.configure(env)
>   File 
> "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py",
>  line 43, in configure
>     hive(name='client')
>   File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", 
> line 89, in thunk
>     return fn(*args, **kwargs)
>   File 
> "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py",
>  line 282, in hive
>     mode = 0644,
>   File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", 
> line 155, in __init__
>     self.env.run()
>   File 
> "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", 
> line 160, in run
>     self.run_action(resource, action)
>   File 
> "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", 
> line 124, in run_action
>     provider_action()
>   File 
> "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py",
>  line 123, in action_create
>     content = self._get_content()
>   File 
> "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py",
>  line 160, in _get_content
>     return content()
>   File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", 
> line 51, in __call__
>     return self.get_content()
>   File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", 
> line 193, in get_content
>     web_file = opener.open(req)
>   File "/usr/lib/python2.7/urllib2.py", line 404, in open
>     response = self._open(req, data)
>   File "/usr/lib/python2.7/urllib2.py", line 422, in _open
>     '_open', req)
>   File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
>     result = func(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
>     return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
>     raise URLError(err)
> urllib2.URLError: <urlopen error [Errno 111] Connection refused>
> {code}
> Which was caused by:
> {code}
> 2017-01-19 16:00:55,016 - 
> File['/usr/lib/ambari-agent/DBConnectionVerification.jar'] {'content': 
> DownloadSource('http://localhost:8080/resources/DBConnectionVerification.jar'),
>  'mode': 0644}
> {code}
> I have searched through the python files and have found that jdk_location in 
> ambari properties is set to "http://localhost:8080/resources";.
> This property is resolved in this file 
> https://github.com/apache/ambari/blob/ddcc13b40902f7fc9144bcaa2af5b54d85442dfa/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
> After that I have tested how this java code behaves on the ambari server 
> machine:
> {code}
> InetAddress.getLocalHost().getCanonicalHostName();
> {code}
> The result is "localhost" (not as expected)
> For command
> {code}
> hostname -f
> {code}
> returns "some-ambari-server.org" (as expected)
> Python code
> {code}
> python -c 'import socket; print(socket.getfqdn())'
> {code}
> returns "some-ambari-server.org" (as expected)
> It seems that such entry in /etc/hosts
> {code}
> 127.0.0.1       localhost   some-ambari-server.org
> {code}
> causes this situation and changing this to
> {code}
> 127.0.0.1       some-ambari-server.org   localhost
> {code}
> fixed the issue.
> I am not sure if it is actually something that should be fixed in code or 
> mentioned in docs - it makes the ambari environment partially stable, apart 
> from the parts which require jdk_location property.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to