Configure a public host name
Edit the host name script on each host to use a public host name.
Edit the contents of the /var/lib/ambari-agent/public_host name.sh
script to return the public host name that you want the Ambari Agent to be configured
Make sure that you chmod the script so it is executable by the user running the Ambari Agent. For most installations, 0755 is the sufficient permission to use.The following script could be used to configure the Ambari Agent to use ‘nn1.hortonworks.local’ as the public host name.
#!/bin/sh echo ‘nn1.hortonworks.local’
Configure the Ambari Agent to use this script by editing the
/etc/ambari-agent/conf/ambari-agent.ini using a text editor.
Add the following property to the [agent] section: public_host name_script=/var/lib/ambari-agent/public_host name.shIn this case, Ambari Agent will use the /var/lib/ambari-agent/public_host name.sh script to determine the host name that it will use as the public host name in the Ambari Server.
Restart the agent for these changes to take effect.