Complete the code to specify the rack ID for a DataNode in HDFS configuration.
dfs.datanode.hostname = [1]The rack ID is specified as a path-like string such as '/rack1/node1' to indicate the rack and node location.
Complete the code to import the class used for rack awareness in HDFS Java code.
import org.apache.hadoop.net.[1];
The class RackResolver is used in Hadoop to resolve rack information for nodes.
Fix the error in the code to get the rack location of a DataNode using RackResolver.
String rack = RackResolver.[1](nodeName);The correct method to get rack info is the static resolve() method on RackResolver.
Fill both blanks to create a rack-aware block placement policy object in HDFS.
BlockPlacementPolicy policy = new [1](conf, [2]);
The BlockPlacementPolicyRackFaultTolerant class is used for rack-aware placement, and it requires a clusterMap object as a parameter.
Fill all three blanks to create a dictionary mapping DataNodes to their rack locations.
Map<String, String> rackMap = new HashMap<>(); for (String node : nodes) { rackMap.put(node, [1].[2](node)); } System.out.println(rackMap.[3]());
We use RackResolver.resolve(node) to get rack info, and keySet() to print all node keys.