Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Please see the Cloudera blog for information on the Cloudera Response to CVE-2021-4428

Rest API automated installation of Cluster

Expert Contributor

From the community threads it is evident that using blueprints is the 'recommended' way to setup a HDP Cluster. But it does not provide incremental updates in which case the rest-api is then referenced. So in order to stream line our installation scripts was attempting to use rest to install the HDP cluster on the HDP 2.6 stack. Can someone point me to what I am doing wrong ?

  1. Have installed all the required software / jdk / ambari-agents on my 3 node setup
  2. Installed ambari-server on one node (testnode) and when it boots up the hosts are registered as evidenced by the call to /api/v1/hosts

Create the cluster and add nodes to it

curl -u admin:admin -i -H "X-Requested-By: ambari" -X POST -d '{"Clusters":{"version":"HDP-2.6"}}' http://testnode:8080/api/v1/clusters/HadoopCluster


for i in fqdn1 fqdn2 fqdn3 ; do 
curl -u admin:admin -i  -i -H "X-Requested-By: ambari" \
 -X POST http://testnode:8080/api/v1/clusters/HadoopCluster/hosts/$i
done;

At this point the hosts are part of the cluster

At this point the repository version is empty

http://testnode:8080/api/v1/stacks/HDP/versions/2.6/repository_versions/

Add stack info

wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.6.3.0/HDP-2.6.3.0-235.xml -O /tmp/HDP-2.6.3.0-235.xml

curl -v -k -u admin:admin -H "X-Requested-By:ambari" -X POST \
http://testnode:8080/api/v1/version_definitions \
-d '{ 
 "VersionDefinition": { 
   "version_url": "file:/tmp/HDP-2.6.3.0-235.xml" 
 } 
}'

Now the repository version exists which can then be used as the desired stack version for the service

Install zookeeper

# add service
curl -u admin:admin -i -H "X-Requested-By: ambari" -X POST \
 -d '{"ServiceInfo":{"service_name":"ZOOKEEPER", "desired_repository_version_id":1}}' \
  http://testnode:8080/api/v1/clusters/HadoopCluster/services
# add components
for i in SERVER CLIENT ; do
 curl -u admin:admin -i -H "X-Requested-By: ambari" -X POST \
  http://testnode:8080/api/v1/clusters/HadoopCluster/services/ZOOKEEPER/components/ZOOKEEPER_$i
end;
# for the sake of brevity had also attempted to add configs zoo.cfg and then adding them as desired configs to the cluster
# add the components to a host
for i in ZOOKEEPER_SERVER ZOOKEEPER_CLIENT ; do 
 curl -u admin:admin -i -H "X-Requested-By: ambari" -X POST -d '{"host_components" : [{"HostRoles":{"component_name":"$i"}}] }' \
  http://testnode:8080/api/v1/clusters/HadoopCluster/hosts?Hosts/host_name=testnode
done;

For all of the above steps , received the appropriate 201 http created status code

finally

curl -u admin:admin -i -H "X-Requested-By: ambari" -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}' http://testnode:8080/api/v1/clusters/HadoopCluster/services/ZOOKEEPER

returns a 202 Accepted and the final status of the request is FAILED.

ambari-server logs have something like this

ERROR [ambari-client-thread-37] ConfigHelper:806 - Unable to find stack configuration cluster-env in ambari configs!

which I also then attempted to set btw, but want to make sure if I am following the right steps. Setting ambari-server log level to DEBUG didn't help much.

0 REPLIES 0