`
szjian
  • 浏览: 72291 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

hadoop的namenode和secondnamenode分开部署在不同服务器

阅读更多
一、系统环境:
Hadoop 0.20.2、JDK 1.6、Linux操作系统

二、使用背景
网上关于hadoop的集群配置,很多情况下,都是把namenode和secondnamenode部署在同一服务器上。为了降低风险,一个大的集群环境,最好是把这两个配置到不同的服务器上。

三、操作
要达到这要求,需要对conf/master、conf/hdfs-site.xml和conf/core-site.xml这三个配置文件进行设置。

1、conf/master文件:
hadoop的官网和大多网上的安装手册,都要求此文件配置namenode机器的IP或是名称。其实,master文件不决定哪个是namenode,而决定的是secondarynamenode(决定谁是namenode的关键配置是core-site.xml中的fs.default.name这个参数)。所以,这里直接写上作为secondnamenode的IP或机器名称(可以是集群中任一个datanode节点)就可以了。一行一个(可以配置多个secondnamenode)。

2、hdfs-site.xml:这个配置文件要改1个参数:
<property>
  <name>dfs.http.address</name>
  <value>hostIP:50070</value>
  <description>
    The address and the base port where the dfs namenode web ui will listen on.
    If the port is 0 then the server will start on a free port.
  </description>
</property>

3、core-site.xml:这里有2个参数可配置,但一般来说我们不做修改。
fs.checkpoint.period表示多长时间记录一次hdfs的镜像。默认是1小时。fs.checkpoint.size表示一次记录多大的size,默认64M。

<property>
  <name>fs.checkpoint.period</name>
  <value>3600</value>
  <description>The number of seconds between two periodic checkpoints.
  </description>
</property>

<property>
  <name>fs.checkpoint.size</name>
  <value>67108864</value>
  <description>The size of the current edit log (in bytes) that triggers
       a periodic checkpoint even if the fs.checkpoint.period hasn't expired.
  </description>
</property>

四、检查结果
配置完成之后,我们需要检查一下是否成功。
1、在运行secondarynamenode的机器上,运行命令jps查看是否存在secondarynamenode进程。如不存在则表示secondarynamenode的启动有异常。
2、如果存在,在查看对应的目录下是否有备份记录。有以下目录结构表示设置成功。
进入hdfs-site.xml文件中配置的fs.checkpoint.dir目录,运行以下命令:
-bash-3.2$ ll namesecondary/
drwxr-xr-x 2 analyzer analyzer 4096 11-03 17:28 current
drwxr-xr-x 2 analyzer analyzer 4096 09-10 01:20 image
-rw-r--r-- 1 analyzer analyzer    0 11-03 16:22 in_use.lock
drwxr-xr-x 2 analyzer analyzer 4096 11-03 16:28 previous.checkpoint

-bash-3.2$ ll namesecondary/current/
-rw-r--r-- 1 analyzer analyzer      4 11-03 17:28 edits
-rw-r--r-- 1 analyzer analyzer 602092 11-03 17:28 fsimage
-rw-r--r-- 1 analyzer analyzer      8 11-03 17:28 fstime
-rw-r--r-- 1 analyzer analyzer    101 11-03 17:28 VERSION
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics