We can use the Hadoop DistributedCache to distribute read-only file-based resources to the Map and Reduce tasks. These resources can be simple data files, archives, or JAR files that are needed for the computations performed by the Mappers or the Reducers.
The following steps show you how to add a file to the Hadoop DistributedCache and how to retrieve it from the Map and Reduce tasks:
$ hadoop fs –copyFromLocal ip2loc.dat ip2loc.dat
Job job = Job.getInstance…… …… job.addCacheFile(new ...