0
0
Hadoopdata~10 mins

Rack awareness in HDFS in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the rack ID for a DataNode in HDFS configuration.

Hadoop
dfs.datanode.hostname = [1]
Drag options to blanks, or click blank then click option'
A/rack1/node1
Brack1-node1
Cnode1
D/rack1
Attempts:
3 left
💡 Hint
Common Mistakes
Using only node name without rack info
Omitting the leading slash in rack ID
2fill in blank
medium

Complete the code to import the class used for rack awareness in HDFS Java code.

Hadoop
import org.apache.hadoop.net.[1];
Drag options to blanks, or click blank then click option'
ARackAwareness
BRackPolicy
CRackResolver
DRackManager
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent classes like RackAwareness or RackManager
Confusing policy classes with resolver classes
3fill in blank
hard

Fix the error in the code to get the rack location of a DataNode using RackResolver.

Hadoop
String rack = RackResolver.[1](nodeName);
Drag options to blanks, or click blank then click option'
AresolveRack
Bresolve
CgetRack
DgetRackLocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that do not exist in RackResolver
Confusing method names with similar sounding ones
4fill in blank
hard

Fill both blanks to create a rack-aware block placement policy object in HDFS.

Hadoop
BlockPlacementPolicy policy = new [1](conf, [2]);
Drag options to blanks, or click blank then click option'
ABlockPlacementPolicyRackFaultTolerant
BBlockPlacementPolicyDefault
Cnull
DclusterMap
Attempts:
3 left
💡 Hint
Common Mistakes
Using default policy instead of rack-aware policy
Passing null instead of cluster map
5fill in blank
hard

Fill all three blanks to create a dictionary mapping DataNodes to their rack locations.

Hadoop
Map<String, String> rackMap = new HashMap<>();
for (String node : nodes) {
    rackMap.put(node, [1].[2](node));
}
System.out.println(rackMap.[3]());
Drag options to blanks, or click blank then click option'
ARackResolver
Bresolve
CkeySet
Dvalues
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong method names for rack resolution
Printing values instead of keys