Set the Rack ID Using Ambari
By setting the Rack ID, you can enable Ambari to manage rack information for hosts, including displaying the hosts in heatmaps by Rack ID, enabling users to filter and find hosts on the Hosts page by using that Rack ID.
If HDFS is installed in your cluster, Ambari passes this Rack ID information to HDFS by using a topology script. Ambari generates a topology script at /etc/hadoop/conf/topology.py and sets the net.topology.script.file.name property in core-site automatically. This topology script reads a mappings file /etc/hadoop/conf/topology_mappings.data that Ambari automatically generates. When you make changes to Rack ID assignment in Ambari, this mappings file will be updated when you push out the HDFS configuration. HDFS uses this topology script to obtain Rack information about the DataNode hosts.
There are two ways using Ambari Web to set the Rack ID: for multiple hosts, using Actions, or for individual hosts, using Host Actions.
To set the Rack ID for multiple hosts:
Steps
Usings Actions, click selected, filtered, or all hosts.
Click Hosts.
Click Set Rack.
To set the Rack ID on an individual host:
Steps
Browse to the Host page.
Click Host Actions.
Click Set Rack.