Hadoop has the concept of "Rack Awareness". Administrators are able to define the rack of each DataNode in the cluster. Making Hadoop rack-aware is extremely important because:
Rack awareness prevents data loss
Rack awareness improves network performance
In this recipe, we will describe how to make Hadoop rack-aware and why it is important.
You will need to know the rack to which each of your slave nodes belongs. Log in to the master node as the user who started Hadoop.
The following steps describe how to make Hadoop rack-aware:
1. Create a
topology.sh
script and store it under the Hadoop configuration directory. Change the path fortopology.data
, in line 3, to fit your environment:hadoop@master1$ vi $HADOOP_HOME/conf/topology.sh while [ $# -gt 0 ] ; do nodeArg=$1 exec< /usr/local/hadoop/current/conf/topology.data result="" while read line ; do ar=( $line ) if [ "${ar[0]}" = "$nodeArg" ] ; then result=...