Search code examples
javahadoopmapreducetmp

How to set hadoop tmp directories using java code


To change hadoop.tmp.dir from the command line I use

export HADOOP_opts="-Dhadoop.tmp.dir=/path/"

But I want to implement this in my java code, but I dont know how to do it. Are there any commands to point the hadoop tmp location in java like if we want to specify the heap space for mapper, we use conf.set("mapred.map.java.opts","-Xmx1024m"). Any pointers would be appreciated.

I tried System.getproperty("hadoop.tmp.dir") to check the location of the tmp directories but it returned null so I guess this is not the way to set the tmp directories in hadoop.


Solution

  • Try Config.set("hadoop.tmp.dir","/new/path").