<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Ambari displays heartbeat lost on all hosts in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233506#M195330</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;@Hpc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Good to know that correcting the&lt;STRONG&gt; /etc/hosts&lt;/STRONG&gt; entry resolved the issue.&lt;/P&gt;&lt;P&gt;Regarding your later query  "&lt;EM&gt;in the "/etc/hosts" file of each host machine, shall I 
only set the hostname of the machine running the ambari-server service, 
or shall I also write the hostname of the all hosts?&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt; Every Node (host) which is part of the cluster need to resolved the hostname of ambari server which is needed for Ambari Server a nd Ambari Agent communication,Also  other components as well needs to know the hostname of other clusternodes. For example the NameNode host should be able to resolve the  hostnames of DataNodes , Similarly the ResourceManager should be able to resolve the hostname of all the NodeManager hosts ...etc   Similarly the ambari service checks runs on different hosts ... &lt;/P&gt;&lt;P&gt;    So basically you should have the same every node of your cluster to be able to resolve each other. &lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 05:02:20 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2018-03-06T05:02:20Z</dc:date>
    <item>
      <title>Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233501#M195325</link>
      <description>&lt;P&gt;Suddenly, Ambari displayed heartbeat lost on all hosts as the following picture shows:&lt;/P&gt;&lt;P&gt;I have tried to generate a new certificate for each host as showed at this &lt;A href="https://community.hortonworks.com/articles/68799/steps-to-fix-ambari-server-agent-expired-certs.html" rel="nofollow noopener noreferrer" target="_blank"&gt;link&lt;/A&gt; but it does not help. Fyi, on all my hosts the folder `/var/lib/ambari-agent/keys` is empty.&lt;/P&gt;&lt;P&gt;If I execute the command `sudo ambari-agent start` I get the following error:&lt;/P&gt;&lt;PRE&gt;Verifying Python version compatibility... Using python /usr/bin/python Checking for previously running Ambari Agent... /run/ambari-agent/ambari-agent.pid found with no process. Removing 3439... Starting ambari-agent Verifying ambari-agent process status... ERROR: ambari-agent start failed. For more details, see /var/log/ambari-agent/ambari-agent.out: ==================== Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/ambari_agent/main.py", line 387, in &amp;lt;module&amp;gt; main(heartbeat_stop_callback) File "/usr/lib/python2.6/site-packages/ambari_agent/main.py", line 355, in main (retries, connected, stopped) = netutil.try_to_connect(server_url, MAX_RETRIES, logger) UnboundLocalError: local variable 'server_url' referenced before assignment ====================&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="64473-screen-shot-2018-03-04-at-234414.png" style="width: 2422px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14742iF127780ABB5B520D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="64473-screen-shot-2018-03-04-at-234414.png" alt="64473-screen-shot-2018-03-04-at-234414.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:14:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233501#M195325</guid>
      <dc:creator>simon123</dc:creator>
      <dc:date>2019-08-18T00:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233502#M195326</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;@Hpc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;We see the error in determining the "server_url"&lt;/P&gt;&lt;PRE&gt;UnboundLocalError: local variable 'server_url' referenced before assignment ====================&lt;/PRE&gt;&lt;P&gt;In general this error can occur if the ambari agent process is somehow not able to determine the ambari server Host &amp;amp; Port information. So please check if the ambari Hostname is resolvable from the Agent machine?  Like looking at the  "/etc/hosts" file on agent to see if Ambari Server IP and Hostname is mapped properly and reachable?&lt;/P&gt;&lt;P&gt;We can also try connecting to Ambari Server host using telnet to see hostname and port resolution:  (From agent machine w can run)  Try using ambari server hostname (FQDN) and IP address both.&lt;/P&gt;&lt;PRE&gt;# telnet $AMBARI_SERVER_HOSTNAME  8080
(OR)
# nc -v $AMBARI_SERVER_HOSTNAME  8080&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;We see that the problem is because of the above error. Ambari Agent is not able to determine the ambari-server hostname (URL).&lt;BR /&gt;This can happen if the &lt;EM&gt;&lt;STRONG&gt;"/etc/ambari-agent/conf/ambari-agent.ini"&lt;/STRONG&gt;&lt;/EM&gt; file might have  an invalid ambari server hostname.  By any chance do you see that the timestamp of this file "/etc/ambari-agent/conf/ambari-agent.ini" is changed?  Or some user (or any automated script) has mistakenly removed the "hostname" and ports from this file?&lt;BR /&gt;.&lt;BR /&gt;Looks like you might be using Ambari 2.4.2 (or 2.4.x) as we see the code here: &lt;A href="https://github.com/apache/ambari/blob/release-2.4.2/ambari-agent/src/main/python/ambari_agent/main.py#L345-L355" target="_blank"&gt;https://github.com/apache/ambari/blob/release-2.4.2/ambari-agent/src/main/python/ambari_agent/main.py#L345-L355&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;    for server_hostname in server_hostnames:
      try:
        server_ip = socket.gethostbyname(server_hostname)
        server_url = config.get_api_url(server_hostname)
        logger.info('Connecting to Ambari server at %s (%s)', server_url, server_ip)
      except socket.error:
        logger.warn("Unable to determine the IP address of the Ambari server '%s'", server_hostname)

      # Wait until MAX_RETRIES to see if server is reachable
      netutil = NetUtil(config, heartbeat_stop_callback)
(retries, connected, stopped) = netutil.try_to_connect(server_url, MAX_RETRIES, logger)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Ambari Agent determines the "server_url" as following: &lt;A href="https://github.com/apache/ambari/blob/release-2.4.2/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py#L249-L252" target="_blank"&gt;https://github.com/apache/ambari/blob/release-2.4.2/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py#L249-L252&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;  def get_api_url(self, server_hostname):
    return "%s://%s:%s" % (self.CONNECTION_PROTOCOL,
                           server_hostname,
                           self.get('server', 'url_port'))&lt;/PRE&gt;&lt;P style="margin-left: 20px;"&gt;.&lt;/P&gt;&lt;P&gt;So please check the "/etc/ambari-server/conf/ambari.properties" file as well to check if by any chance the "client.port" or "api.ssl"   etc are changed recently?&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 07:33:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233502#M195326</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-03-05T07:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233503#M195327</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;@Hpc&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A similar issue is reported here:  &lt;A href="https://issues.apache.org/jira/browse/AMBARI-19246" target="_blank"&gt;https://issues.apache.org/jira/browse/AMBARI-19246&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So if you keep seeing this issue then explore an option to upgrade your ambari.&lt;/P&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 08:11:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233503#M195327</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-03-05T08:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233504#M195328</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;@Hpc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you can not upgrade your ambari binaries to atleast 2.5 then you can try the workaround as mentioned in :  &lt;A href="https://issues.apache.org/jira/browse/AMBARI-19246"&gt;https://issues.apache.org/jira/browse/AMBARI-19246&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Which says just move the [  &lt;EM&gt;&lt;STRONG&gt;server_url = config.get_api_url(server_hostname)&lt;/STRONG&gt;&lt;/EM&gt; ]  line outside the try block.  See:  &lt;A href="https://reviews.apache.org/r/54890/diff/1#index_header" target="_blank"&gt;https://reviews.apache.org/r/54890/diff/1#index_header&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can make this change on all the ambari agent machines by editing the file: "/usr/lib/python2.6/site-packages/ambari_agent/main.py"&lt;/P&gt;&lt;PRE&gt;    for server_hostname in server_hostnames:
      server_url = config.get_api_url(server_hostname)
      try:
        server_ip = socket.gethostbyname(server_hostname)
        logger.info('Connecting to Ambari server at %s (%s)', server_url, server_ip)&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 08:52:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233504#M195328</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-03-05T08:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233505#M195329</link>
      <description>&lt;P&gt;HI &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay Kumar SenSharma&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the reply. By setting the hostname of the machine running the ambari-server service, in the "/etc/hosts" file of each host machine, helped to solve the problem.&lt;/P&gt;&lt;P&gt;Quick question: in the "/etc/hosts" file of each host machine, shall I only set the hostname of the machine running the ambari-server service, or shall I also write the hostname of the all hosts? Because my cluster is composed by serveral machines, and different services, such as, YARN, Spark, Mapreduce&amp;lt; HIVE etc. are running on different machines (for example, some machine are Nodemanager, other machine run the Hive server etc.). &lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 01:37:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233505#M195329</guid>
      <dc:creator>simon123</dc:creator>
      <dc:date>2018-03-06T01:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari displays heartbeat lost on all hosts</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233506#M195330</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70228/paolorosso89.html" nodeid="70228"&gt;@Hpc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Good to know that correcting the&lt;STRONG&gt; /etc/hosts&lt;/STRONG&gt; entry resolved the issue.&lt;/P&gt;&lt;P&gt;Regarding your later query  "&lt;EM&gt;in the "/etc/hosts" file of each host machine, shall I 
only set the hostname of the machine running the ambari-server service, 
or shall I also write the hostname of the all hosts?&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt; Every Node (host) which is part of the cluster need to resolved the hostname of ambari server which is needed for Ambari Server a nd Ambari Agent communication,Also  other components as well needs to know the hostname of other clusternodes. For example the NameNode host should be able to resolve the  hostnames of DataNodes , Similarly the ResourceManager should be able to resolve the hostname of all the NodeManager hosts ...etc   Similarly the ambari service checks runs on different hosts ... &lt;/P&gt;&lt;P&gt;    So basically you should have the same every node of your cluster to be able to resolve each other. &lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 05:02:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-displays-heartbeat-lost-on-all-hosts/m-p/233506#M195330</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-03-06T05:02:20Z</dc:date>
    </item>
  </channel>
</rss>

