Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar

Ambari REST APIs to add a component in kerberized cluster. I tried and tested these in Ambari 2.4.1 version

Here is an example to install SECONDARY_NAMENODE

1. API to Add a Component

curl -s -H "X-Requested-By:ambari" --user admin:admin -i -X POST -d '{"host_components":[{"HostRoles":{"component_name":"SECONDARY_NAMENODE"}}]}' http://AMBARIHOST:8080/api/v1/clusters/CLUSTERNAME/hosts?Hosts/host_name=COMPONENTHOST

2. API to install the Above added component.

curl -s -H "X-Requested-By:ambari" --user admin:admin -i -X PUT -d '{"RequestInfo":{"context":"Install SECONDARY_NAMENODE","operation_level":{"level":"HOST_COMPONENT","cluster_name":"test","host_name":"COMPONENTHOST","service_name":"HDFS"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://AMBARIHOST:8080/api/v1/clusters/CLUSTERNAME/hosts/COMPONENTHOST/host_components/SECONDARY_NAM...

3. API to provide kerberos credentials.

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

Note: Replace CLUSTERNAME, AMBARIHOST, COMPONENTHOST with appropriate values

1,745 Views
0 Kudos