Support Questions
Find answers, ask questions, and share your expertise

Error in registering hosts on Ambari 2.5

Error in registering hosts on Ambari 2.5

New Contributor

Hi,

I am trying to setup a cluster with Ambari 2.5 on Ubuntu 14.04 and keep on getting the following error while registering hosts.

ERROR 2017-05-02 05:16:35,285 main.py:244 - Ambari agent machine hostname (localhost) does not match expected ambari server hostname (pos2-retl1). Aborting registration. Please check hostname, hostname -f and /etc/hosts file to confirm your hostname is setup correctly

SSH is working fine from ambari server host to other hosts and I have completed the environment setup. Attempted manual registration as well.

10 REPLIES 10

Re: Error in registering hosts on Ambari 2.5

Super Mentor

@Danula Eranjith

This error message indicates that you have not setup the "FQDN" properly on your hosts.

Please make sure that the output of the following commands is reflecting your correct hostname and is accessible from the ambari host.

# hostname -f

.

Re: Error in registering hosts on Ambari 2.5

New Contributor
hostname -f 

returns the correct hostname (pos2-retl1). Somehow Ambari agent machine hostname (localhost) is incorrect.

Re: Error in registering hosts on Ambari 2.5

Super Mentor

@Danula Eranjith

Can you please check and share the "/etc/hosts" file was updated with the proper IP address and FQDN through out the cluster nodes. Also the "ambari-agent.ini" file to verify if it is using the correct Ambari Hostname.

Re: Error in registering hosts on Ambari 2.5

Super Mentor

@Danula Eranjith

Sometime back i have written an article that explains how we can have customized hostname and tell ambari-agent to use it.

https://community.hortonworks.com/articles/42872/why-ambari-host-might-have-different-public-host-n....

Please try using the "hostname_script" and "public_hostname_script" attributes in your "/etc/ambari-agent/conf/ambari-agent.ini" and in the [agent] to define your own script to use the hostname.

Example:

public_hostname_script=/var/lib/ambari-agent/public_hostname.sh
hostname_script=/var/lib/ambari-agent/public_hostname.sh

.

Re: Error in registering hosts on Ambari 2.5

@Danula Eranjith

Can you please check below config and make sure it is pointing to the correct ambari-server ?

/etc/ambari-agent/conf/ambari-agent.ini

Re: Error in registering hosts on Ambari 2.5

New Contributor

@Santhosh B Gowda

Config file has the hostname as localhost which is incorrect.

Re: Error in registering hosts on Ambari 2.5

Please update the config to point to the correct ambari server endpoint

[server]
hostname = <ambari-server-ip>
url_port = 8440

Re: Error in registering hosts on Ambari 2.5

New Contributor

UPDATE ========

I get the correct hostname set in /etc/hosts when I run

hostname -f

Somehow when I run the following, I don't get the correct host

python -c 'import socket; print socket.getfqdn()'

This hostname difference is caused by a python issue with socket.getfqdn(). Details regarding this specific python issue can be found at https://bugs.python.org/issue5004.

Ambari code also uses the same socket.getfqdn() to get the hostname thus resulting in the error I have mentioned in the question. I have not come across a workaround or a solution yet.