Ambari Cheat Sheet

[ Ambari] is the web frontend to administer the Hadoop platform. DAPLAB is running Ambari v2. Official documentation for Ambari and how to use it is available either on the Ambari wiki or in the HortonWorks documentation. This page aims at giving some tips and tricks, and contextualizing to the DAPLAB infrastructure the examples found online.

In all the examples below, ${ambari_credentials} refers to your username and password used to log into Ambari UI, concatenated with : -- admin:admin by default:



List all the hosts:

curl -v -X GET -u ${ambari_credentials} -H 'X-Requested-By:ambari'

Alerts Definition

curl -v -X GET -u ${ambari_credentials} -H 'X-Requested-By:ambari'

curl -v -X GET -u ${ambari_credentials} -H 'X-Requested-By:ambari'


curl -v -X POST --data "$payload" -u ${ambari_credentials} -H 'X-Requested-By:ambari'

  "AlertDefinition" : {
    "cluster_name" : "DAPLAB02",
    "component_name" : "PIG",
    "description" : "abcd",
    "enabled" : true,
    "ignore_host" : false,
    "interval" : 1,
    "label" : "Custom Check3",
    "name" : "custom_check_3",
    "scope" : "SERVICE",
    "service_name" : "PIG",
    "source" : {
      "parameters" : [ ],
      "path" : "/usr/local/bin/",
      "type" : "SCRIPT"

curl -v -X DELETE -u ${ambari_credentials} -H 'X-Requested-By:ambari'

Deleting a Journal Node

Source ici.

  1. Ensure the JournalNode is stopped
curl -u ${ambari_credentials} -H 'X-Requested-By: Ambari' -X PUT -d '{"RequestInfo":{"context":"Install JournalNode"},"Body":{"HostRoles":{"state":"INSTALLED"}}}'${cluster}/hosts/${host}/host_components/JOURNALNODE
  1. Delete the JournalNode
curl -u ${ambari_credentials} -H 'X-Requested-By: Ambari' -X DELETE${cluster}/hosts/${host}/host_components/JOURNALNODE

Assign JournalNode

Assign the role of JournalNode using the following command:

curl -u ${ambari_credentials} -H 'X-Requested-By: Ambari' -X POST

Install Journalnode

Now go ahead and install the JournalNode.

curl -u ${ambari_credentials} -H 'X-Requested-By: Ambari' -X PUT -d '{"RequestInfo":{"context":"Install JournalNode"},"Body":{"HostRoles":{"state":"INSTALLED"}}}'