Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SampleDistributedCache
- {
- public static class DCMapper extends Mapper<Object, Text, Text, IntWritable>
- {
- //Get the list of uris for the files added in DC
- Path[] uris = DistributedCache.getLocalCacheFiles(context.getConfiguration());
- try{
- BufferedReader readBuff = new BufferedReader(new FileReader(uris[0].toString()));
- String line;
- while ((line=readBuff.readLine())!=null)
- {
- System.out.println(line);
- }
- readBuff.close();
- }
- catch (Exception e)
- {
- System.out.println(e.toString());
- }
- }
- public static void main(String[] args) throws Exception {
- DistributedCache.addCacheFile(new URI("hdfs://yournamenode/configFile.cfg"),job.getConfiguration());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement