Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ambari Cluster Creation - Exception when creating a Resource Error

Highlighted

Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

I am trying to create a cluster with some nodes, I am able to register the ambari-agents manually only in my host machine, which is going to act as master, but I am unable to register other machines, it creates an Exception when creating a Resource

After giving the fully qualified domain name, it gives registration with the server failed

Ambari-server.log gives

31 Mar 2016 11:40:52,184 ERROR [qtp-client-23] AbstractResourceProvider:279 - Caught AmbariException when creating a resource org.apache.ambari.server.HostNotFoundException: Host not found, hostname=localhostcs1.sridhar.com at org.apache.ambari.server.state.cluster.ClustersImpl.getHost(ClustersImpl.java:343) at org.apache.ambari.server.state.ConfigHelper.getEffectiveDesiredTags(ConfigHelper.java:108) at org.apache.ambari.server.controller.AmbariManagementControllerImpl.findConfigurationTagsWithOverrides(AmbariManagementControllerImpl.java:1820) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:37) at com.sun.proxy.$Proxy82.findConfigurationTagsWithOverrides(Unknown Source) at org.apache.ambari.server.controller.AmbariActionExecutionHelper.addExecutionCommandsToStage(AmbariActionExecutionHelper.java:372) ..............

It is giving host not found exception, but my /etc/hosts file has list of other host machines along with their IP FQDN Hostname

my /etc/hosts file content is

127.0.0.1localhost.localdomain localhost 127.0.1.1sridhar25.sridhar.com sridhar25 192.168.117.153 sridhar25.sridhar.com sridhar25 192.168.117.107 localhostcs1.sridhar.com localhostcs1 192.168.117.140 localhostcs2.sridhar.com localhostcs2 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters

My host machine sridhar25.sridhar.com got registered successfully, but another client machines localhostcs1 and localhostcs2 are getting registration failed. I have checked all possibilities like SSH without password connection , forward and reverse dns, ping and checking connection between host machines, etc

How ambari-server sees the hostname or gets the host name may provide a solution to this problem.....

This problem is persisting for very long time!

Thanks

Sridhar

11 REPLIES 11

Re: Ambari Cluster Creation - Exception when creating a Resource Error

New Contributor

If you have access to the database, can you query the hosts table and see what Ambari _thinks_ what hosts you should have? The hostnames there must be the same as what the agent is announcing for itself. The agent logs should give you a hint as well.

For example:

"INFO 2016-03-31 10:43:31,883 Controller.py:145 - Registering with c6401.ambari.apache.org (192.168.1.1) ..."

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

@Nate

I have accessed the Ambari Database, but there is no table for hosts, I will upload the screenshot of all tables in ambaridb.

3123-screenshot-from-2016-04-01-093117.png

Re: Ambari Cluster Creation - Exception when creating a Resource Error

New Contributor

What are the tables after hostgroup? You must have the table, Ambari wouldn't even start without it. What happens when you execute the query indicated by @vpoornalingam?

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

when I execute the command select * from hosts;

it gives me relation does not exist

ambari=# SELECT * FROM hosts; ERROR: relation "hosts" does not exist LINE 1: SELECT * FROM hosts;

when I give /dt it gives no relations found,

but when I give /dt .*. it lists many relations

ambari-# \dt No relations found. ambari-# \dt .*.

3166-apr2.png

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Guru

Can you post the output of this REST call to the Ambari Server (replace localhost with the Ambari Server host)?

curl -i -H "X-Requested-By: ambari" -u admin:admin -X GET http://localhost:8080p/api/v1/hosts

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

@jeff

Output of the above curl command

HTTP/1.1 200 OK User: admin Set-Cookie: AMBARISESSIONID=1tgdgh5asgw0d8e1osgx8ug8p;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: text/plain Vary: Accept-Encoding, User-Agent Content-Length: 273 Server: Jetty(8.1.17.v20150415) { "href" : "http://localhost:8080/api/v1/hosts", "items" : [ { "href" : "http://localhost:8080/api/v1/hosts/sridhar25.sridhar.com", "Hosts" : { "cluster_name" : "sridhar_master1", "host_name" : "sridhar25.sridhar.com" } } ] }

Re: Ambari Cluster Creation - Exception when creating a Resource Error

@Sridhar Babu M

Ambari would most likely see the hostname as what's returned by the following python program:

[root@vpoornal-1 ~]# python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket;
>>> print socket.getfqdn();
vpoornal-1.novalocal
>>> quit();
[root@vpoornal-1 ~]# hostname -f
vpoornal-1.novalocal

Also, connect to Ambari db and run:

select * from hosts;

and check if its matching with the nodes.

You could also check this with the curl command posted by @jeff

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

@vpoornalingam

After running the python statements I am getting the appropriate hostname (FQDN)

sridhar25.sridhar.com

After connecting to ambaridb, there is no table called hosts,

the list of tables in the ambaridb are in below image,

3122-screenshot-from-2016-04-01-093117.png

I have queried for adminpermission, hostgroup tables, there is nothing about list of hosts,

Re: Ambari Cluster Creation - Exception when creating a Resource Error

Contributor

Sry, there is a table called hosts in ambari db,

but I am unable to query it

Select * from hosts, gives me relation not found,

More info, in previous comments.

Thanks