官术网_书友最值得收藏!

Time for action – changing the base HDFS directory

Let's first set the base directory that specifies the location on the local filesystem under which Hadoop will keep all its data. Carry out the following steps:

  1. Create a directory into which Hadoop will store its data:
    $ mkdir /var/lib/hadoop
    
  2. Ensure the directory is writeable by any user:
    $ chmod 777 /var/lib/hadoop
    
  3. Modify core-site.xml once again to add the following property:
    <property>
    <name>hadoop.tmp.dir</name>
    <value>/var/lib/hadoop</value>
    </property>

What just happened?

As we will be storing data in Hadoop and all the various components are running on our local host, this data will need to be stored on our local filesystem somewhere. Regardless of the mode, Hadoop by default uses the hadoop.tmp.dir property as the base directory under which all files and data are written.

MapReduce, for example, uses a /mapred directory under this base directory; HDFS uses /dfs. The danger is that the default value of hadoop.tmp.dir is /tmp and some Linux distributions delete the contents of /tmp on each reboot. So it's safer to explicitly state where the data is to be held.

主站蜘蛛池模板: 那坡县| 淮滨县| 惠东县| 安丘市| 蒙山县| 华宁县| 师宗县| 綦江县| 监利县| 乌海市| 静宁县| 防城港市| 闽侯县| 库车县| 抚州市| 潮安县| 贡觉县| 杭锦后旗| 蒲江县| 南宫市| 福州市| 宜城市| 云南省| 鞍山市| 隆安县| 西充县| 手游| 兴文县| 陆丰市| 安康市| 祁东县| 双柏县| 博乐市| 隆化县| 哈尔滨市| 阳新县| 武陟县| 册亨县| 会泽县| 安阳县| 赤峰市|