好吧,书接上回,话说安装完Hadoop1.2.1后,开始琢磨琢磨配置
以下开始进行对配置文件进行简单说明:
Hadoop的各组件都可以用xml文件进行配置。
一般配置的话,主要是三个配置文件:
core-site.xml:用于配置Common组件的属。
hdfs-site.xml:用于配置HDFS的属性,
HDFS顾名思义Hadoop Distributed
File System,Hadoop分布式文件系统。
mapred-site.xml:用于配置MapReduce属性。
这些文件都在
$HADOOP_INSTALL的conf目录下可以找到。
注:这里需要另外说明一下:在Hadoop的早期版本中,
只有一个配置文件来配置这三项,叫hadoop_site.xml的配置文件,
后期开始分为三个,一一对应个组件。属性内容不变,仅仅是分开。
另外,在docs目录中还有对应的三个html文件,分别保存着各组件的默认设置。
然后,然后,说明以下Hadoop的运行模式:
Hadoop拥有以下三种运行模式:
第一:独立模式(standalone)或者我喜欢叫他
本地模式(local model)
此模式无需守护进程,所有的程序都在单个的虚拟机上运行。
由于在本地模式下测试和调试MapReduce程序很方便,所以一般来说比较适用于开发阶段。
第二:伪分布模式(pseudo-distributed
model)
顾名思义,一个模拟的小规模的集群,Hadoop守护进程运行在本地环境中。
一般用作测试环境。
第三:全分布模式(fully
distributed model)
这才是真实的,Hadoop守护进程运行在真正的集群环境。
一般作为产品环境。
注:在无论哪个模式下去运行Hadoop都需要关注两个重要因素:
1.是否启动Hadoop守护进程,2.是否已经正确配置各属性。
下面这个表里简单列举了三种模式下的所需的最小属性配置集合:
|
组件名称 |
属性名称 |
独立模式 |
伪分布模式 |
全分布模式 |
|
Common |
fs.default.name |
file:///(默认) |
hdfs://localhost/ |
hdfs://namenode/ |
|
HDFS |
dfs.replication |
N/A |
1 |
3(默认) |
|
MapReduce |
mapred.job.tracker |
local(默认) |
localhost:8021 |
jobtracker:8021 |
那么,那么,说一下三种模式下的配置:
本机模式:
一般Hadoop安装后默认属性就是本地模式(独立模式),所以一般来说,不用再非二遍事来进行更多的配置。
三个配置文件内容如下:(里面其实啥也木有)
-----core-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
伪分布模式:
三个配置配置文件内容如下:
-----core-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
fs.default.name
hdfs://localhost/
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
dfs.replication
1
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
mapred.job.tracker
localhost:8021
全分布模式:
三个配置配置文件内容如下:
-----core-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
fs.default.name
hdfs://namenode/
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
dfs.replication
3
-----mapred-site.xml-----
<!-- Put
site-specific property overrides in this file.
-->
mapred.job.tracker
jobtracker:8021
恩,暂时写到这里。
by
Markboo
<!-- 正文结束 -->
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22340015/viewspace-1120030/
,如需转载,请注明出处,否则将追究法律责任。