用户登录
用户注册

分享至

hadoop启动namenode

  • 作者: 墨镜不懂夜的黑
  • 来源: 51数据库
  • 2020-09-21
1.修改conf/core-site.xml
增加


fs.checkpoint.period
3600
The number of seconds between two periodic checkpoints.


fs.checkpoint.size
67108864
The size of the current edit log (in bytes) that triggers a periodic checkpoint even if the fs.checkpoint.period hasn't expired.



fs.checkpoint.dir
/data/work/hdfs/namesecondary
Determines where on the local filesystem the DFS secondary name node should store the temporary images to merge. If this is a comma-delimited list of directories then the image is replicated in all of the directories for redundancy.


fs.checkpoint.period表示多长时间记录一次hdfs的镜像。默认是1小时。
fs.checkpoint.size表示一次记录多大的size,默认64M
2.修改conf/hdfs-site.xml
增加

dfs.http.address
master:50070
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.


0.0.0.0改为namenode的IP地址
3.重启hadoop,然后检查是否启动是否成功
登录secondarynamenode所在的机器,输入jps查看secondarynamenode进程
进入secondarynamenode的目录/data/work/hdfs/namesecondary
正确的结果:
如果没有,请耐心等待,只有到了设置的checkpoint的时间或者大小,才会生成。
4.恢复
制造namenode宕机的情况
1) kill 掉namenode的进程
[root@master name]# jps
11749 NameNode
12339 Jps
11905 JobTracker
[root@master name]# kill 11749

2)删除dfs.name.dir所指向的文件夹,这里是/data/work/hdfs/name
[root@master name]# rm -rf *

删除name目录下的所有内容,但是必须保证name这个目录是存在的

3)从secondarynamenode远程拷贝namesecondary文件到namenode的namesecondary
[root@master hdfs]# scp -r slave-001:/data/work/hdfs/namesecondary/ ./

4)启动namenode
[root@master /data]# hadoop namenode –importCheckpoint

正常启动以后,屏幕上会显示很多log,这个时候namenode就可以正常访问了



  第一步:修改core-site.xml,配置如下内容:





fs.default.name
hdfs://localhost:9000
true



dfs.replication
1



第二步:修改hdfs-site.xml文件,配置如下内容:





dfs.name.dir
/cygdrive/d/hadoop/working/name
true


dfs.data.dir
/cygdrive/d/hadoop/working/data
true


fs.checkpoint.dir
/cygdrive/d/hadoop/working/checkpoint
true


第三步:修改mapred-site.xml配置如下内容:





mapred.job.tracker
hdfs://localhost:9001
true


mapred.local.dir
/cygdrive/d/hadoop/working/dir1,/cygdrive/d/hadoop/working/dir2
true


mapred.system.dir
/cygdrive/d/hadoop/working/system
true



第4步,进入cygwin客户端,执行
$ cd /cygdrive/d/hadoop 【其中/d/hadoop 为hadoop安装目录,即d:\hadoop,linux表示路径和windows不同】
$ bin/hadoop namenode –format 【格式化namenode】
第5步,修改工作目录权限
$ bin/hadoop dfs chmod 777 /cygdrive/d/hadoop/working 【/cygdrive/d/hadoop/working 为工作目录,默认是tmp】

第6步,启动hadoop
$ bin/start-all.sh
$ ps –ef
通过ps查看进程,能看到5个java进程,即成功。
转载,仅供参考。
软件
前端设计
程序设计
Java相关