Chapter 6. Using Custom Host Names
You can customize the agent registration host name and the public host name used for each host in Ambari. Use this capability when "hostname" does not return the public network host name for your machines.
To customize a host name:
Steps
In the Cluster Installer wizard, at the Install Options step , click Perform Manual Registration for Ambari Agents.
Install an Ambari Agent manually on each host.
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. Make sure that youchmodthe script so it is executable by the Agent.#!/bin/sh echo `hostname -f`
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.sh
where
/var/lib/ambari-agent/hostname.shis the path to your custom hostname script.To generate a public host name 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. Make sure that youchmodthe script so it is executable by the Agent.#!/bin/sh echo `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.sh
where
/var/lib/ambari-agent/public_hostname.shis the path to your custom public hostname script.If applicable, add the host names to
/etc/hostson every host.Restart the Agent on every host for these changes to take effect.
ambari-agent restart
More Information

