This API capability is available as a preview in Ambari 1.5.0.
Ambari Blueprints are a declarative definition of a cluster. With a Blueprint, you specify a Stack, the Component layout and the Configurations to materialize a Hadoop cluster instance (via a REST API) without having to use the Ambari Cluster Install Wizard.
Notable JIRAs
JIRA | Description |
---|---|
AMBARI-4467 | Blueprints REST resource. |
AMBARI-5077 | Provision cluster with blueprint. |
AMBARI-4786 | Export blueprints from running/existing cluster. |
AMBARI-5114 | Configurations with blueprints. |
Basic API Resources
Resource | Description |
---|---|
GET /blueprints | Returns the available blueprints. |
POST /blueprints/:name | Creates a blueprint. |
POST /clusters/:name | Creates a cluster. |
GET /clusters/:name?format=blueprint | Export the current cluster layout as a blueprint. |
Preparing Your Ambari Server and Agents
- Perform your Ambari Server install and setup.
- Start your Ambari Server.
- Install Ambari Agents on the hosts you plan to include in your cluster.
- Set the Ambari Server hostname on the Ambari Agents and start the Agents to perform manual registration.
- Proceed with defining your blueprint and creating a cluster instance from that blueprint.
Example: Single-Node Cluster
- Single-node cluster (c6401.ambari.apache.org)
- HDP 2.0 Stack
- Install Core Hadoop Services (HDFS, YARN, MapReduce2, ZooKeeper)
Step 0: Prepare Ambari Server and Ambari Agent
Install the Ambari Server, run setup and start. Install the Ambari Agent and perform manual registration.
Step 1: Define your blueprint
The blueprint ("single-node-hdfs-yarn") below defines with one host group ("host_group_1") which hosts all the components (masters, slaves and clients).
{ "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" : "MAPREDUCE2_CLIENT" }, { "name" : "ZOOKEEPER_SERVER" }, { "name" : "ZOOKEEPER_CLIENT" } ], "cardinality" : "1" } ], "Blueprints" : { "blueprint_name" : "single-node-hdfs-yarn", "stack_name" : "HDP", "stack_version" : "2.0" } }
Step 2: Create blueprint in Ambari Server
Post the blueprint to the "single-node-hdfs-yarn" resource to the Ambari Server.
POST /api/v1/blueprints/single-node-hdfs-yarn 201 - Created
Step 3: Map hosts to blueprint + host groups for the cluster instance
We are performing a single-node install and the blueprint above has one host group. Therefore, for our cluster instance, we define one host in host_group_1 and reference the single-node-hdfs-yarn blueprint.
{ "blueprint" : "single-node-hdfs-yarn", "host-groups" :[ { "name" : "host_group_1", "hosts" : [ { "fqdn" : "c6401.ambari.apache.org" } ] } ] }
Step 4: Create cluster instance with blueprint
Post the cluster to the Ambari Server to provision the cluster.
POST /api/v1/cluster/MySingleNodeCluster 202 - Accepted { "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/requests/1", "Requests" : { "id" : 1, "status" : "InProgress" } }
Example: Multi-Node Cluster
- Multi-node cluster (three hosts)
- Host Groups: “master”, “slaves” (one master host, two slave hosts)
- Use HDP 2.0 Stack
- Install Core Hadoop Services (HDFS, YARN, MapReduce2, ZooKeeper)
Step 0: Prepare Ambari Server and Ambari Agent
Install the Ambari Server, run setup and start. Install the Ambari Agent and perform manual registration.
Step 1: Define your blueprint
The blueprint ("multi-node-hdfs-yarn") below defines with two host groups (a "master" and the "slaves") which hosts the various Service components (masters, slaves and clients).
{ "host_groups" : [ { "name" : "master", "components" : [ { "name" : "NAMENODE" }, { "name" : "SECONDARY_NAMENODE" }, { "name" : "RESOURCEMANAGER" }, { "name" : "HISTORYSERVER" }, { "name" : "NAGIOS_SERVER" }, { "name" : "ZOOKEEPER_SERVER" } ], "cardinality" : "1" }, { "name" : "slaves", "components" : [ { "name" : "DATANODE" }, { "name" : "HDFS_CLIENT" }, { "name" : "NODEMANAGER" }, { "name" : "YARN_CLIENT" }, { "name" : "MAPREDUCE2_CLIENT" }, { "name" : "ZOOKEEPER_CLIENT" } ], "cardinality" : "2" } ], "Blueprints" : { "blueprint_name" : "multi-node-hdfs-yarn", "stack_name" : "HDP", "stack_version" : "2.0" } }
Step 2: Create blueprint in Ambari Server
Post the blueprint to the "single-node-hdfs-yarn" resource to the Ambari Server.
POST /api/v1/blueprints/multi-node-hdfs-yarn 201 - Created
Step 3: Map hosts to blueprint + host groups for the cluster instance
We are performing a multi-node install and the blueprint above has two host groups. Therefore, for our cluster instance, we define one host in masters, two hosts in slaves and reference the multi-node-hdfs-yarn blueprint.
{ "blueprint" : "multi-node-hdfs-yarn", "host-groups" :[ { "name" : "master", "hosts" : [ { "fqdn" : "c6401.ambari.apache.org" } ] }, { "name" : "slaves", "hosts" : [ { "fqdn" : "c6402.ambari.apache.org" }, { "fqdn" : "c6403.ambari.apache.org" } ] } ] }
Step 4: Create cluster instance with blueprint
Post the cluster to the Ambari Server to provision the cluster.
POST /api/v1/cluster/MyThreeNodeCluster 202 - Accepted { "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/requests/1", "Requests" : { "id" : 1, "status" : "InProgress" } }