Apache Ambari Tutorial: Hadoop Cluster Management (2026)
Apache Ambari provides a web-based management interface for provisioning, managing, and monitoring Hadoop clusters. After deploying Ambari for clusters with hundreds of nodes, I appreciate how it simplifies operations tasks that would otherwise require dozens of custom scripts and manual configuration.
This tutorial covers Ambari's architecture, service management, alerting, stack definitions, and API-driven automation for managing production Hadoop clusters.
Ambari Architecture and Components
Ambari consists of an Ambari Server (manages cluster state), Ambari Agent (runs on each node), and Ambari Database (stores cluster topology and configuration). The Ambari Server coordinates agent communication, manages service configurations, and provides the web UI. Agents execute commands on their local nodes and report status back.
Ambari stores cluster topology, configurations, and metrics in its database (PostgreSQL or MySQL). The Ambari REST API provides programmatic access to all management operations — everything the UI does can be done via API.
# Ambari server setup
$ ambari-server setup
# Database: PostgreSQL
# Host: ambari-db
# Port: 5432
# Database: ambari
# User: ambari
# Start services
$ ambari-server start
$ ambari-agent start # on each agent node
# Access web UI
open http://ambari-server:8080
# Default credentials: admin/admin
# Verify cluster
$ curl -u admin:admin http://ambari-server:8080/api/v1/clusters/my-cluster
Service Management and Configuration
Ambari manages Hadoop services (HDFS, YARN, Hive, HBase, etc.) through service definitions (stacks). Each stack defines service components, configuration properties, and lifecycle commands. Ambari tracks service health, configuration versions, and dependency relationships.
Configuration changes are versioned — Ambari keeps a complete history of every configuration change and which user made it. Rollback to previous configurations is a single click or API call.
# Update configuration via API
curl -X PUT -H 'X-Requested-By: ambari' \
-u admin:admin \
-d '{
"Clusters": {
"desired_configs": {
"type": "hdfs-site",
"tag": "version2"
}
}
}' \
http://ambari-server:8080/api/v1/clusters/my-cluster
# Get current configuration
curl -u admin:admin \
http://ambari-server:8080/api/v1/clusters/my-cluster/configurations?type=hdfs-site
# Restart a service
curl -X POST -H 'X-Requested-By: ambari' \
-u admin:admin \
-d '{"RequestInfo":{"context":"Restart HDFS"}}' \
http://ambari-server:8080/api/v1/clusters/my-cluster/services/HDFS/restart
Stacks and Service Definitions
Ambari Stacks define available services and their versions. The HDP stack includes HDFS, YARN, Hive, HBase, and more. Custom stacks let you add proprietary services or custom versions. Each stack defines services, components, configurations, and lifecycle commands.
Upgrading Hadoop distributions is managed through Ambari's rolling upgrade process. Ambari handles component-by-component upgrade with automatic rollback on failure, reducing the risk of major version upgrades.
# Custom stack definition
# /var/lib/ambari-server/resources/stacks/CUSTOM/3.0/metainfo.xml
2.0
CUSTOM_SERVICE
Custom Service
1.0.0
CUSTOM_SERVICE_MASTER
Custom Service Master
MASTER
PYTHON
# Service lifecycle scripts
# scripts/master.py
def configure(env):
put_config('custom-site.xml')
def start(env):
env.execute('bin/start-custom.sh')
def stop(env):
env.execute('bin/stop-custom.sh')
Alerting and Health Monitoring
Ambari provides built-in alerts for service health, disk usage, metric thresholds, and web service availability. Alerts are configurable per service and can send email notifications, call webhooks, or integrate with PagerDuty. Alert definitions are stack-aware — each service can define custom alert checks.
Ambari Metrics collects host-level metrics (CPU, memory, disk, network) and service-level metrics (HDFS bytes written, YARN containers running). These are stored in a time-series database and available for dashboards and alerting.
# Alert configuration via API
# Get current alerts
curl -u admin:admin \
http://ambari-server:8080/api/v1/clusters/my-cluster/alerts
# Alert definitions
curl -u admin:admin \
http://ambari-server:8080/api/v1/alert_definitions
# Create custom alert
curl -X POST -H 'X-Requested-By: ambari' -u admin:admin \
-d '{
"AlertDefinition": {
"label": "Disk Usage",
"name": "DISK_USAGE",
"description": "Alert when disk usage exceeds 85%",
"component": null,
"scope": "HOST",
"enabled": true,
"source": {
"type": "SCRIPT",
"path": "alert_scripts/check_disk_usage.py",
"parameters": [{"name": "threshold", "value": "85"}]
}
}
}' \
http://ambari-server:8080/api/v1/alert_definitions
API-Driven Automation
Ambari's REST API enables full automation of cluster management. Every operation available in the UI — service start/stop, configuration changes, host addition, component installation — has an API equivalent. This enables infrastructure-as-code patterns for Hadoop clusters.
The API supports bulk operations for adding multiple hosts, installing services across the cluster, and applying configuration changes. Combine with Terraform or Ansible for complete cluster provisioning automation.
# Add a host to the cluster
curl -X POST -H 'X-Requested-By: ambari' -u admin:admin \
-d '{
"Hosts": {
"host_name": "new-node-01"
}
}' \
http://ambari-server:8080/api/v1/clusters/my-cluster/hosts
# Install a service component
curl -X POST -H 'X-Requested-By: ambari' -u admin:admin \
-d '{
"RequestInfo": {
"context": "Install HDFS DataNode on new-node-01",
"command": "INSTALL"
},
"Body": {
"hostComponents": [{
"HostRoles": {
"component_name": "DATANODE",
"host_name": "new-node-01"
}
}]
}
}' \
http://ambari-server:8080/api/v1/clusters/my-cluster/hosts/new-node-01/host_components/DATANODE
# Bulk check service health
curl -u admin:admin \
http://ambari-server:8080/api/v1/clusters/my-cluster/services | jq '.items[] | {name: .StackServices.service_name, health: .healthState}'
Cluster Provisioning and Blueprint Deployment
Ambari Blueprints define complete cluster configurations as JSON. A blueprint specifies hosts, services, components, and configurations. Deploying a blueprint provisions a cluster from scratch in minutes, ensuring consistent and reproducible deployments across environments.
Blueprints capture the entire cluster topology: which services run on which hosts, configuration properties, and host groups. This enables disaster recovery by redeploying the same blueprint on new infrastructure.
# Blueprint JSON
{
"Blueprints": {
"stack_name": "HDP",
"stack_version": "3.1"
},
"host_groups": [
{
"name": "master",
"cardinality": 1,
"components": [
{"name": "NAMENODE"},
{"name": "RESOURCEMANAGER"},
{"name": "HIVEMETASTORE"},
{"name": "ZOOKEEPER_SERVER"}
]
},
{
"name": "workers",
"cardinality": 10,
"components": [
{"name": "DATANODE"},
{"name": "NODEMANAGER"}
]
}
],
"configurations": [
{
"hdfs-site": {
"dfs.replication": 3,
"dfs.datanode.data.dir": "/data/hdfs/dn"
}
}
]
}
# Deploy blueprint
curl -X POST -H 'X-Requested-By: ambari' -u admin:admin \
-d @blueprint.json \
http://ambari-server:8080/api/v1/blueprints/my-cluster
Frequently Asked Questions
What is the difference between Ambari and Cloudera Manager?
Both are Hadoop cluster management tools. Ambari is open-source Apache. Cloudera Manager is proprietary (now CDP Management Console). Cloudera Manager has more enterprise features; Ambari is free and customizable.
Can Ambari manage non-HDP clusters?
Yes, Ambari can manage Apache Hadoop distributions through custom stacks. You can define stacks for any Hadoop distribution or custom services.
How does Ambari handle rolling upgrades?
Ambari orchestrates component-by-component upgrades: stop a component, upgrade it, restart, verify health, then proceed to the next component. This minimizes downtime during major version upgrades.
Is Ambari still actively maintained?
Ambari 2.7.x is the latest stable release. Active development has slowed as Cloudera focuses on CDP. However, the open-source community maintains forks for specific use cases.
Originally published on Ayodhyyya. Last updated June 1, 2026.