Seems like rack awareness is not configure.
Try to follow the below-given steps to configure rack awareness:
1. Stop all the daemons running.
$ ./stop-all.sh
2. Create a topology data file anywhere in Master node (NameNode)
$ vi topology.data
3. Mention your slave nodes ( DataNodes) relative to their rack into topology.data- as follows:
192.168.1.4 /rack1
192.168.1.5 /rack1
192.168.1.6 /rack2
192.168.1.7 /rack2
192.168.1.8 /rack3
5. Create a topology.sh script file
#!/bin/bash
while [ $# -gt 0 ] ; do
nodeArg=$1
exec< /home/hadoop/topology.data
result=""
while read line ; do
ar=( $line )
if [ "${ar[0]}" = "$nodeArg" ] ; then
result="${ar[1]}"
fi
done
shift
if [ -z "$result" ]; then
echo -n "/default/rack "
else
echo -n "$result "
fi
done
6. Add the below property into hdfs-site.xml of Master node.
<property>
<name>topology.script.file.name</name>
<value>/home/hadoop/topology.sh</value>
</property>
7. Start the Hadoop cluster command: ./start-dfs.sh
8. Check the Hadoop admin report to see if the cluster is aware of the rack.
$ hadoop dfsadmin -report