##
# 配置文件均在$HADOOP_HOME/conf下
##
1.在/home下新建hdfs用户,并给予足够权限
sudo mkdir hdfs
sudo chmod -R 777 hdfs
sudo chown leon hdfs
2.core-site.xml (修改hdfs的网络接口和tmp地址。其中tmp地址必须本地化,确保重启后不用格式化hdfs,以保存hdfs中的文件)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hdfs/tmp</value>
</property>
</configuration>
3.hdfs-site.xml(设置备份文件数。单机版配置1,正常分布式配置3)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
4.配置mapreduce的接口
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>
5.关闭hadoop,重新格式化namenode
bin/stop-all.sh
bin/hadoop namenode -format
6.检查是否配置完成
bin/start-all.sh
# 配置文件均在$HADOOP_HOME/conf下
##
1.在/home下新建hdfs用户,并给予足够权限
sudo mkdir hdfs
sudo chmod -R 777 hdfs
sudo chown leon hdfs
2.core-site.xml (修改hdfs的网络接口和tmp地址。其中tmp地址必须本地化,确保重启后不用格式化hdfs,以保存hdfs中的文件)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hdfs/tmp</value>
</property>
</configuration>
3.hdfs-site.xml(设置备份文件数。单机版配置1,正常分布式配置3)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
4.配置mapreduce的接口
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
</configuration>
5.关闭hadoop,重新格式化namenode
bin/stop-all.sh
bin/hadoop namenode -format
6.检查是否配置完成
bin/start-all.sh
bin/hadoop dfsadmin -report