You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

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

JIRADescription
AMBARI-4467Blueprints REST resource.
AMBARI-5077Provision cluster with blueprint.
AMBARI-4786Export blueprints from running/existing cluster.
AMBARI-5114Configurations with blueprints.

Basic API Resources

ResourceDescription
GET /blueprintsReturns the available blueprints.
POST /blueprints/:nameCreates a blueprint.
POST /clusters/:nameCreates a cluster.
GET /clusters/:name?format=blueprintExport the current cluster layout as a blueprint.

Preparing Your Ambari Server and Agents

  1. Perform your Ambari Server install and setup.
    yum install ambari-server
    ambari-server setup

  2. Start your Ambari Server.
    ambari-server start

  3. Install Ambari Agents on the hosts you plan to include in your cluster.
    yum install ambari-agent

  4. Set the Ambari Server on the Ambari Agents.
    vi /etc/ambari-agent/conf/ambari-agent.ini

  5. Set hostname= to the Fully Qualified Domain Name for the Ambari Server. Save and exit.
    hostname=c6401.ambari.apache.org

  6. Start the Agents to initiate registration to Server.
    ambari-agent start

  7. Confirm the Agent hosts are registered with the Server.
    http://your.ambari.server:8080/api/vi/hosts

  8. 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/clusters/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/clusters/MyThreeNodeCluster

202 - Accepted
{
  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/requests/1",
  "Requests" : {
    "id" : 1,
    "status" : "InProgress"
  }
}
  • No labels