Database Reference
In-Depth Information
The Hadoop configuration must specify a map between node addresses and network loca-
tions. The map is described by a Java interface,
DNSToSwitchMapping
, whose signa-
ture is:
public interface
DNSToSwitchMapping
{
public
List
<
String
>
resolve
(
List
<
String
>
names
);
}
The
names
parameter is a list of IP addresses, and the return value is a list of correspond-
ing network location strings. The
net.topology.node.switch.mapping.impl
configuration property defines an implementation of the
DNSToSwitchMapping
inter-
face that the namenode and the resource manager use to resolve worker node network loc-
ations.
For the network in our example, we would map
node1
,
node2
, and
node3
to
/rack1
, and
node4
,
node5
, and
node6
to
/rack2
.
Most installations don't need to implement the interface themselves, however, since the
default implementation is
ScriptBasedMapping
, which runs a user-defined script to
determine the mapping. The script's location is controlled by the property
net.topology.script.file.name
. The script must accept a variable number of
arguments that are the hostnames or IP addresses to be mapped, and it must emit the cor-
responding network locations to standard output, separated by whitespace. The
Hadoop
wiki
has an example.
If no script location is specified, the default behavior is to map all nodes to a single net-
work location, called
/default-rack
.