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或是名称。www.codesky.net 其实,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的镜像。www.codesky.net 默认是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
最新文章
- Html5+NodeJS——拖拽多个文件上传到服务器
- Rust初步(四):在rust中处理时间
- Nancy之结合TinyFox调试备忘
- 51nod1066(bash博弈)
- ASP.NET Web API 配置返回的json字段的格式以及Action返回HttpResponseMessage类型和IHttpActionResult类型
- Java条件编译
- 【BZOJ-3172】单词 AC自动机
- hive 未初始化元数据库报错
- 多项分布(multinominal distribution)
- HTML5基础知识(一)---标签
- MappedByteBuffer高速缓存文件、RandomAccessFile随机访问
- matrix矩阵求逆 与解方程模板 留做备用 (有bug,待补充)
- Python语法
- Kafka 客户端实现逻辑分析
- POJ 3398 Perfect Service(树型动态规划,最小支配集)
- 《SpringMVC从入门到放肆》十二、SpringMVC自定义类型转换器
- 说一说MVC的过滤器(一)
- SQL性能优化十条经验,后台程序员都需要掌握
- Shell 实践、常用脚本
- iOS autoLayout总结
热门文章
- Hadoop如何修改HDFS文件存储块大小
- [原创]java WEB学习笔记19:初识MVC 设计模式:查询,删除 练习(理解思想),小结 ,问题
- CSS3图片悬停放大动画
- render总结
- nginx Unit 服务器
- running a background task over ssh
- Linux课程---11、Linux中软件安装和调试
- Linux课程---3、Linux远程登录和传输(操作Linux服务器软件)
- Eclipse_插件_01_tomcat插件的安装
- javaScript-进阶篇(二)