hdfs格式化hadoop namenode -format错误
在对HDFS格式化,执行hadoop namenode -format命令时,出现未知的主机名的问题,异常信息如下所示:
[shirdrn@localhost bin]$ hadoop namenode -format
11/06/22 07:33:31 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 0.20.0
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20 -r 763504; compiled by 'ndaley' on Thu Apr 9 05:18:40 UTC 2009
************************************************************/
Re-format filesystem in /tmp/hadoop/hadoop-shirdrn/dfs/name ? (Y or N) Y
11/06/22 07:33:36 INFO namenode.FSNamesystem: fsOwner=shirdrn,shirdrn
11/06/22 07:33:36 INFO namenode.FSNamesystem: supergroup=supergroup
11/06/22 07:33:36 INFO namenode.FSNamesystem: isPermissionEnabled=true
11/06/22 07:33:36 INFO metrics.MetricsUtil: Unable to obtain hostName
java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
at org.apache.hadoop.metrics.MetricsUtil.getHostName(MetricsUtil.java:91)
at org.apache.hadoop.metrics.MetricsUtil.createRecord(MetricsUtil.java:80)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.initialize(FSDirectory.java:73)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.<init>(FSDirectory.java:68)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:370)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:853)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:947)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:964)
11/06/22 07:33:36 INFO common.Storage: Image file of size 97 saved in 0 seconds.
11/06/22 07:33:36 INFO common.Storage: Storage directory /tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.
11/06/22 07:33:36 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException: localhost.localdomain: localhost.localdomain
************************************************************/
我们通过执行hostname命令可以看到:
[shirdrn@localhost bin]# hostname
localhost.localdomain
也就是说,Hadoop在格式化HDFS的时候,通过hostname命令获取到的主机名是localhost.localdomain,然后在/etc/hosts文件中进行映射的时候,没有找到,看下我的/etc/hosts内容:
[root@localhost bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost
192.168.1.103 localhost localhost
也就说,通过localhost.localdomain根本无法映射到一个IP地址,所以报错了。
此时,我们查看一下/etc/sysconfig/network文件:
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=localhost.localdomain
可见,执行hostname获取到这里配置的HOSTNAME的值。
解决办法:
修改/etc/sysconfig/network中HOSTNAME的值为localhost,或者自己指定的主机名,保证localhost在/etc/hosts文件中映射为正确的IP地址,然后重新启动网络服务:(如果下面方法行不通,只能重启一下了)
[root@localhost bin]# /etc/rc.d/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
这时,再执行格式化HDFS命令,以及启动HDFS集群就正常了:
[shirdrn@localhost bin]$ hadoop namenode -format
11/06/22 08:02:37 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = localhost/127.0.0.1
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 0.20.0
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20 -r 763504; compiled by 'ndaley' on Thu Apr 9 05:18:40 UTC 2009
************************************************************/
11/06/22 08:02:37 INFO namenode.FSNamesystem: fsOwner=shirdrn,shirdrn
11/06/22 08:02:37 INFO namenode.FSNamesystem: supergroup=supergroup
11/06/22 08:02:37 INFO namenode.FSNamesystem: isPermissionEnabled=true
11/06/22 08:02:37 INFO common.Storage: Image file of size 97 saved in 0 seconds.
11/06/22 08:02:37 INFO common.Storage: Storage directory /tmp/hadoop/hadoop-shirdrn/dfs/name has been successfully formatted.
11/06/22 08:02:37 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1
************************************************************/
[shirdrn@localhost bin]$ start-all.sh
starting namenode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-namenode-localhost.out
localhost: starting datanode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-datanode-localhost.out
localhost: starting secondarynamenode, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-secondarynamenode-localhost.out
starting jobtracker, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-jobtracker-localhost.out
localhost: starting tasktracker, logging to /home/shirdrn/eclipse/eclipse-3.5.2/hadoop/hadoop-0.20.0/logs/hadoop-shirdrn-tasktracker-localhost.out
[shirdrn@localhost bin]$ jps
8192 TaskTracker
7905 DataNode
7806 NameNode
8065 JobTracker
8002 SecondaryNameNode
8234 Jps
hdfs格式化hadoop namenode -format错误的更多相关文章
- 对hadoop namenode -format执行过程的探究
引言 本文出于一个疑问:hadoop namenode -format到底在我的linux系统里面做了些什么? 步骤 第1个文件bin/hadoop Hadoop脚本位于hadoop根目录下的bi ...
- hadoop namenode -format Couldn'tload main class "-Djava.library.path=.home.hadoop.hadoop-2.5.2.lib"
<pre name="code" class="sql">[hadoop@MasterHadoop50 ~]$ hadoop namenode -f ...
- "hadoop namenode -format"命令的作用和影响的文件
在hadoop部署好了之后是不能马上应用的,而是对配置的文件系统进行格式化.这里的文件系统,在物理上还未存在,或者用网络磁盘来描述更加合适:还有格式化,并不是传统意义上的磁盘清理,而是一些清除与准备工 ...
- Docker Hadoop 配置常见错误及解决办法
Docker Hadoop 配置常见错误及解决办法 问题1:wordcount运行卡住,hadoop 任务运行到running job就卡住了 INFO mapreduce.Job: Running ...
- Hadoop 新建集群namenode format
在hadoop部署好了之后是不能马上应用的,还要对配置的文件系统进行格式化. 使用命令: hadoop namenode -format 注释:namenode和secondary namenode均 ...
- hadoop namenode多次格式化后,导致datanode启动不了
jps hadoop namenode -format dfs directory : /home/hadoop/dfs --data --current/VERSION #Wed Jul :: CS ...
- HDFS 中文件操作的错误集锦
问题1 Java ApI执行追加写入时:无法写入 问题描述: ①当前数据节点无法写入,②追加文件需要再次请求. 问题2 命令行执行追加写入时:无法写入 问题描述: 当前数据节点无法写入 问题3 ...
- Hadoop - Mac OSX下配置和启动hadoop以及常见错误解决
0. 安装JDK 参考网上教程在OSX下安装jdk 1. 下载及安装hadoop a) 下载地址: http://hadoop.apache.org b) 配置ssh环境 在terminal里面输入: ...
- hadoop nameNode 无法启动
/************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_M ...
随机推荐
- scipy cluster聚类 ---Python3
官方文档: https://docs.scipy.org/doc/scipy/reference/cluster.vq.html
- 仿qq的侧拉菜单效果
自定义控件 import android.animation.ArgbEvaluator; import android.animation.FloatEvaluator; import androi ...
- 第10章:DOM
- 背景background
background简写:http://www.cnblogs.com/dunken/p/4380194.html
- 曾经让我很吐血的Bug(初学者)
1.MSSql 就是 sql Server. 2.用session的时候一定要先实现接口IRequiresSessionState: 3.form表单中type=file传送文件的时候一定要在form ...
- fiddler还是浏览器的问题
当我在浏览器里输入http://localhost/infomanage/price?cityid=1&cateid=246&timer=3 后端接收的参数是timer的时候,浏览器会 ...
- 【故障】当Eclipse打不开的时候
某天,当你打开Eclipse的时候,弹出这种路径错误的界面.那么,该怎么办呢??? 参考: https://zhidao.baidu.com/question/1497777962705951219. ...
- STM32驱动ht1621b显示LCD
这几天在写ht1621b显示LCD的程序,主芯片是Stm32f10的芯片.对于stm32和ht1621b的运用和操作本人是新手,属于赶鸭子上架,通过查看datasheet等资料和网上查看前人写的程序终 ...
- jsp中使用java函数
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> ${fn ...
- 修改redis端口号
为redis分配一个8888端口,操作步骤如下:1.$REDIS_HOME/redis.conf重新复制一份,重命名为redis8888.conf.2.打开redis8888.conf配置文件,找到p ...