Automate HDP installation using Ambari Blueprints – Part 1
What are Ambari Blueprints ?
Ambari Blueprints are definition of your HDP cluster in “JSON” format, it contents information about all the hosts in your cluster, their components, mapping of stack components with each hosts or hostgroups and other cool stuff. Using Blueprints we can call Ambari APIs to completely automate HDP installation process. Interesting stuff, isn’t it ?
Lets get started with single node cluster installation. Below are the steps to setup single-node HDP cluster with Ambari Blueprints.
.
Note - For Ambari 2.6.X onwards, we will have to register VDF to register internal repository, or else Ambari will pick up latest version of HDP and use the public repos. please see below document for more information. For Ambari version less than 2.6.X, this guide will work without any modifications.
.
Step 1: Install Ambari server using steps mentioned under below link
.
Step 2: Register ambari-agent manually
Install ambari-agent package on all the nodes in the cluster and modify hostname to ambari server host(fqdn) in /etc/ambari-agent/conf/ambari-agent.ini
.
Step 3: Configure blueprints
Please follow below steps to create Blueprints
3.1 Create hostmapping.json file as shown below:
{
"blueprint" : "single-node-hdp-cluster",
"default_password" : "admin",
"host_groups" :[
{
"name" : "host_group_1",
"hosts" : [
{
"fqdn" : "<fqdn-of-single-node-cluster-machine>"
}
]
}
]
}
.
3.2 Create cluster_configuration.json file, it contents mapping of hosts to HDP components
{
"configurations" : [ ],
"host_groups" : [
{
"name" : "host_group_1",
"components" : [
{
"name" : "NAMENODE"
},
{
"name" : "SECONDARY_NAMENODE"
},
{
"name" : "DATANODE"
},
{
"name" : "HDFS_CLIENT"
},
{
"name" : "RESOURCEMANAGER"
},
{
"name" : "NODEMANAGER"
},
{
"name" : "YARN_CLIENT"
},
{
"name" : "HISTORYSERVER"
},
{
"name" : "APP_TIMELINE_SERVER"
},
{
"name" : "MAPREDUCE2_CLIENT"
},
{
"name" : "ZOOKEEPER_SERVER"
},
{
"name" : "ZOOKEEPER_CLIENT"
}
],
"cardinality" : "1"
}
],
"Blueprints" : {
"blueprint_name" : "single-node-hdp-cluster",
"stack_name" : "HDP",
"stack_version" : "2.3"
}
}
.
Step 4: Register blueprint with ambari server by executing below command
curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://<ambari-hostname>:8080/api/v1/blueprints/<blueprint-name>; -d @cluster_configuration.json
.
Srep 5: Pull the trigger! Below command will start cluster installation.
curl -H "X-Requested-By: ambari" -X POST -u admin:admin http://<ambari-host>:8080/api/v1/clusters/<new-cluster-name>; -d @hostmapping.json
.
Step 6: We can track installation status by below REST call or we can check the same from ambari UI
curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://<ambari-hostname>:8080/api/v1/clusters/mycluster/requests/
curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://<ambari-hostname>:8080/api/v1/clusters/mycluster/requests/<request-number>;
.
Thank you for your time! Please read next part to see installation of HDP multinode cluster using Ambari Blueprints.
.

