Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ambari API call failing -install host component

avatar
Explorer

I am trying to install components using a python script. Based loosely upon the community example I found here:

https://github.com/datagulp/hdp_utilities/blob/master/autoScale.sh


At the step where I get a list of components from another compute node, then try to replicate, I can add each component onto a node with a POST successfully. I can see the components being added. But when I try to then do a PUT to set the state of each one to INSTALLED, it fails.


curl -u user1 -i -H "X-Requested-By:ambari" -X PUT -d '{"HostRoles": {"state":"INSTALLED"}}' http://my-ambari-host:8080/api/v1/clusters/my-cluster/hosts/my-host/host_components/ATLAS_CLIENT

{

"status" : 400,

"message" : "java.lang.IllegalArgumentException: Missing KDC administrator credentials.\nThe KDC administrator credentials must be set as a persisted or temporary credential resource.This may be done by issuing a POST to the /api/v1/clusters/:clusterName/credentials/kdc.admin.credential API entry point with the following payload:\n{\n \"Credential\" : {\n \"principal\" : \"(PRINCIPAL)\", \"key\" : \"(PASSWORD)\", \"type\" : \"(persisted|temporary)\"}\n }\n}"

}



1 ACCEPTED SOLUTION

avatar
Master Mentor

@Michael Klaene

In a kerberized cluster you will need to first post your "kdc.admin.credential" to Ambari and then try your other API calls like

Example: (Please provide your KDC principal and credentials there.

# curl -s -H "X-Requested-By:ambari" --user admin:admin -i -X POST -d '{ "Credential" : { "principal" : "admin/admin", "key" : "admin", "type" : "temporary" } }' http://my-ambari-host:8080/api/v1/clusters/my-cluster/credentials/kdc.admin.credential


Then try your API calls:

# curl --user admin:admin -i -H "X-Requested-By:ambari" -X PUT -d '{"HostRoles": {"state":"INSTALLED"}}' http://my-ambari-host:8080/api/v1/clusters/my-cluster/hosts/my-host/host_components/ATLAS_CLIENT

.

The temporary credential store is a keystore in memory where each entry is removed after 90 minutes (from initial creation), when Ambari is restarted, or by user request. The persisted credential store is a keystore stored on disk where each entry is removed only by user request. The option to store a credential in the persisted store is only available if Ambari's credential store has been setup.


Please refer to the following HCC Article as well: https://community.hortonworks.com/articles/42927/adding-kdc-administrator-credentials-to-the-ambari....


View solution in original post

5 REPLIES 5

avatar
Explorer

Our cluster is protected via Kerberos but I can't understand why I would need to perform this step for this particular command when I was able to add a host and add components via POST apis without an issue, using Basic Auth.

avatar
Master Mentor

@Michael Klaene

In a kerberized cluster you will need to first post your "kdc.admin.credential" to Ambari and then try your other API calls like

Example: (Please provide your KDC principal and credentials there.

# curl -s -H "X-Requested-By:ambari" --user admin:admin -i -X POST -d '{ "Credential" : { "principal" : "admin/admin", "key" : "admin", "type" : "temporary" } }' http://my-ambari-host:8080/api/v1/clusters/my-cluster/credentials/kdc.admin.credential


Then try your API calls:

# curl --user admin:admin -i -H "X-Requested-By:ambari" -X PUT -d '{"HostRoles": {"state":"INSTALLED"}}' http://my-ambari-host:8080/api/v1/clusters/my-cluster/hosts/my-host/host_components/ATLAS_CLIENT

.

The temporary credential store is a keystore in memory where each entry is removed after 90 minutes (from initial creation), when Ambari is restarted, or by user request. The persisted credential store is a keystore stored on disk where each entry is removed only by user request. The option to store a credential in the persisted store is only available if Ambari's credential store has been setup.


Please refer to the following HCC Article as well: https://community.hortonworks.com/articles/42927/adding-kdc-administrator-credentials-to-the-ambari....


avatar
Master Mentor

@Michael Klaene

Good to know that adding temporary credential store resolved your issue.

It will be also wonderful if you can mark this thread answered by clicking the "Accept" button on the helpful answer that way it will be more useful for other hcc users to quickly browser answers.

avatar
Explorer

Ok. Thanks. I will try this and post back. I still don't understand why 2 POST calls were successful without doing this, then fails on this PUT call.

avatar
Explorer

Thanks. Solved this by adding temporary credential store.