You can customize the agent registration hostname and the public hostname used for each host in Ambari. Use this capability when "hostname" does not return the public network hostname for your machines.
To customize the name of each host in your cluster:
On the Install Options screen, select Perform Manual Registration for Ambari Agents.
Install the Agents manually, as described in Installing Ambari Agents Manually.
To echo the customized name of the host to which the Ambari agent registers, for every host, create a script like the following example, named
/var/lib/ambari-agent/hostname.sh.#!/bin/sh echo <ambari_hostname>
Open
/etc/ambari-agent/conf/ambari-agent.inion every host, using a text editor.Add to the agent section the following line:
hostname_script=/var/lib/ambari-agent/hostname.shwhere
/var/lib/ambari-agent/hostname.shis the name of your custom echo script.To generate a public hostname for every host, create a script like the following example, named
/var/lib/ambari-agent/public_hostname.shto show the name for that host in the UI.#!/bin/bash hostname <-f>
Open
/etc/ambari-agent/conf/ambari-agent.inion every host, using a text editor.Add to the agent section the following line:
public_hostname_script=/var/lib/ambari-agent/public_hostname.shAdd the hostnames to
/etc/hostson every host.

