Search code examples
hadoopconfigurationhdfsconfiguration-files

Where exactly should hadoop.tmp.dir be set? core-site.xml or hdfs-site.xml?


I'm asking about the Hadoop 2.x series. There's conflicting advice about this on the Internet. Like in this case where he asks to specify it in core-site.xml and this SO answer where it is mentioned that hadoop.tmp.dir be set in hdfs-site.xml. Which is the right place to put it?


Solution

  • hadoop.tmp.dir (A base for other temporary directories) is property, that need to be set in core-site.xml, it is like export in linux

    Ex:

    <name>dfs.namenode.name.dir</name>
    <value>file://${hadoop.tmp.dir}/dfs/name</value>
    

    You can use reference of hadoop.tmp.dir in hdfs-site.xml like above

    For more core-site.xml and hdfs-site.xml

    There're three HDFS properties which contain hadoop.tmp.dir in their values

    dfs.name.dir: directory where namenode stores its metadata, with default value ${hadoop.tmp.dir}/dfs/name.

    dfs.data.dir: directory where HDFS data blocks are stored, with default value ${hadoop.tmp.dir}/dfs/data.

    fs.checkpoint.dir: directory where secondary namenode store its checkpoints, default value is ${hadoop.tmp.dir}/dfs/namesecondary